Reddit Question · 2025 Q1

Horrible Interview Experience at Amazon

341 upvotes 70 replies

Question Details

Had an Amazon interview where I was asked to find the Lowest Common Ancestor (LCA) in a Binary Tree. I implemented the standard O(n) DFS approach, but the interviewer insisted on further optimization.

Full Details

Had an Amazon interview where I was asked to find the Lowest Common Ancestor (LCA) in a Binary Tree. I implemented the standard O(n) DFS approach, but the interviewer insisted on further optimization. After 10 minutes of struggling, he gave a vague hint: "Try modifying the data structure." Eventually, he asked me to assume that parent pointers were available, completely changing the problem. I Finally explained the optimal O(log n) solution, but he rejected me im assuming for taking too long. Felt unfair since I wasn’t given complete constraints upfront. I even asked whether i should code up the treenode structure to which he said its already understood.
Free preview — Unlock all questions →

Topics

Trees Graphs