Home > Reflections | ⏮️ ⏭️

# 2024-08-01

## 🏋 Coding Practice

### 112. Path Sum

Given the

`root`

of a binary tree and an integer`targetSum`

, return`true`

if the tree has aroot-to-leafpath such that adding up all the values along the path equals`targetSum`

.

Aleafis a node with no children.

#### 🪞 Reflections

- Never great to get a wrong submission
- This was due to a misunderstanding of the problem.
- A careless mistake - I should read the description more carefully.
- My initial implementation did what I wanted it to - just not what the problem was looking for.
- This highlights the importance of asking clarifying questions during a real interview

- Finding my way back to a working solution in under 25 minutes isn’t terrible
- The initial implementation came out quickly and without much waffling or difficulty
- Manual testing
- I added the null-checks as I wrote the initial code, which feels more efficient than coming back afterword
- while my tree notation for test values isn’t hyper-efficient, it’s much easier to work with than the super efficient, but easy to misread list annotation used in LeetCode examples (e.g.
`[1,2,3,null]`

- Testing the recursive implementation felt natural and effective

- All in all, a nice warm up for my real interview later today
- I intentionally chose an
`Easy`

LeetCode problem just to warm up my usual routine without inducing too much stress by struggling with a more challenging problem on the day of an interview.

- I intentionally chose an