Trees
Trees sit right behind graphs as a coding family in an Amazon loop, and almost every tree question is the same recursion in a slightly different form. One problem recurs more than any other single question Amazon asks: a Premium question, the deepest node sitting above two given ones. No other single problem comes up as often. Once you decide to recurse, one question is left: what does each node need, an answer built from its children, or context handed down from its ancestors?
That one decision splits nearly all tree problems into two shapes. You either solve the subtrees first and combine their results on the way back up. Or you carry information down as you descend, acting on it at each node. Name which shape you're in, and most tree interviews unstick. Amazon's interviewer is also scoring your Leadership Principles while you talk, so reasoning clearly weighs as much as the code itself.
- 3 problems, worked step by step
- 4 diagrams
- about 24 min
Premium lessonAmazon interview guide
These took digging.
What candidates walked out with, from 20,000+ reports, forum threads behind logins and write-ups in Chinese. Then solved step by step.
100 companies. Checked every month.
Unlock all 100 companies$49 a year · less than $1 a week · Cancel anytime
Amazon interview guideKnow what Amazon asks before you walk in.
19 coding · 6 system design · 44 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.