Each tree problem asked what a single subtree should hand back to its parent, and how deep or wide the tree could get. This is what each exercise asked of you:
| Exercise | The question that unlocked it |
|---|---|
| Count Comments in a Thread | How many comments does this reply’s subtree report, and how do I add them up once? |
| Deepest Nesting in a Page Tree | What happens to the call stack when the page is tens of thousands of elements deep? |
| Org Chart Level by Level | Who is on the next row, and how do I collect them without shifting a huge queue? |
| Validate a Binary Search Tree | Which range of values is this node allowed to hold, given every ancestor above it? |
A quick self-check: think of the test that stayed red the longest for you. Which assumption in your code did it break? Interviewers often ask exactly that kind of question, and it’s a lot easier to answer once you’ve talked it through.
Want a second pair of eyes on your Tree work?
From here on, the label comes off. Mixed Practice hands you problems without saying which structure or walk they need, just like an interviewer would.