Round 1
Questions:
- 236. Lowest Common Ancestor of a Binary Tree
- 31. Next Permutation
For Q1, I was able to complete it using the most optimal approach. I answered all parts of the question and walked through edge cases with the interviewer.
For Q2, I started by discussing the brute-force approach (N!) before the interviewer pushed me to think of a more optimal N approach. Since I had seen this question a while back, I had a vague memory of the optimal solution. After taking a moment to think aloud and using the examples the interviewer provided, I was able to figure out the logic without any help. I only had 2 minutes left to code and unfortunately ran out of time with 3 lines remaining.
Candidate's Approach
For the first question, I utilized the most optimal approach and ensured to cover all edge cases during my explanation. For the second question, I initially discussed the brute-force method and then, with the interviewer's guidance, I was able to derive the optimal solution logic. However, I ran out of time before I could complete the coding part.
Interviewer's Feedback
No feedback provided.