Round 1
Questions:
- Valid Palindrome with removing one character - explained brute force and optimal solution and solved it optimally.
- Follow-up: Asked me Valid Palindrome with removing k characters but just told me to say my approach (not code it) and asked for time complexity.
- LRU Cache - honestly this tripped me up a bit but I was able to implement most of it in the time complexity asked O(1), however I ended up confusing myself a bit with the hashmap and once the interviewer pointed it out, I was able to correct myself for the most part.
Candidate's Approach
For the Valid Palindrome question, I explained both the brute force and optimal solutions. I was able to solve it optimally. For the follow-up question regarding removing k characters, I discussed my approach without coding it and provided the time complexity.
For the LRU Cache, I attempted to implement it with O(1) time complexity but got confused with the hashmap. After the interviewer pointed it out, I corrected myself.
Interviewer's Feedback
No feedback provided.
Round 2
Questions:
-
Range Sum of BST - I solved it brute force (visiting all the nodes in the tree) and then solved it again optimally.
-
Number of Islands - but you have to find the "properties" in the island bordering water. I explained the optimal approach but turns out I didn’t fully understand the problem. I wrote the code out and missed one edge case (if the property is at the edge of the graph it counts as a property bordering water). After I wrote my code we walked through a test case but didn’t have time to finish as we were almost out of time.
Candidate's Approach
For the Range Sum of BST, I initially solved it using a brute force method by visiting all nodes and then provided an optimal solution. For the Number of Islands question, I explained my optimal approach but realized I misunderstood the problem, particularly missing an edge case regarding properties at the edge of the graph. We started to walk through a test case but ran out of time before finishing.
Interviewer's Feedback
No feedback provided.
Behavioral Round
Questions: Specific question not provided.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.