Round 1: Coding Round 1
Questions:
- 680: Valid Palindrome II
- Was asked to think of edge cases like what if input has spaces or punctuation. Sort of evolved into 125. Valid Palindrome.
- 863: All Nodes Distance K in Binary Tree
- Tree nodes did not have parent pointers. Said that to go exactly K nodes away, we would need graph traversal and need to go up, so told interviewer that we needed to create graph.
- Created a new graph with Node.connections = [list containing parent, left, right nodes], but interviewer seemed unhappy that I created an additional graph object to store left right nodes when I only needed to store parent nodes.
Candidate's Approach
- For Valid Palindrome II, I considered edge cases involving spaces and punctuation.
- For All Nodes Distance K in Binary Tree, I defended my approach of creating a new graph for clarity in BFS traversal, despite the interviewer's concerns about duplicating the tree.
Interviewer's Feedback
- The interviewer seemed unhappy with the decision to create an additional graph object for the left and right nodes, indicating a preference for a more straightforward solution.
Round 2: Coding Round 2
Questions:
- 65: Valid Number
- Was asked to think of edge cases and asked about 0 and its variants (0, 0., .0, 0.0, etc).
- 347: Top K Frequent Elements
- Gave 3 approaches with time and space complexities: sorting, heap, quick select.
- Interviewer asked to code heap-based approach. Follow up question was to make it O(n) constant time, not O(n) avg time.
Candidate's Approach
- For Valid Number, I got stuck coding the edge cases but was able to resolve it with hints.
- For Top K Frequent Elements, I proposed bucketing but struggled with the correct implementation as time ran out.
Interviewer's Feedback
- The interviewer noted that the approach to make it O(n) constant time was incorrect and indicated that I had chosen the wrong method for bucketing.
Round 3: System Design
Questions:
- The question was generic and aligned with common system design questions found in platforms like Leetcode, Strava, Uber, Tinder.
Candidate's Approach
- I signed an NDA, so I cannot disclose specifics, but I recommend preparing with mock interviews for system design, which helped me significantly.
Interviewer's Feedback
- No feedback provided.
Tips
- System Design: Always mention back of the envelope calculations. It shows concern for scaling and can satisfy interviewers looking for that detail.
- Coding: Stress the importance of validation testing and edge cases. Be proactive in testing your code against provided examples and consider various input scenarios.