Round 1
Questions:
- Trapping rain water LC #42 (https://leetcode.com/problems/trapping-rain-water/description/)
- Reverse linked list in k groups LC #25 (https://leetcode.com/problems/reverse-nodes-in-k-group/description/)
Test Cases:
- For Trapping Rain Water:
- Input: height = [0,1,0,2,1,0,1,3,2,1,2,1]
- Output: 6
- For Reverse Linked List in K Groups:
- Input: head = [1,2,3,4,5], k = 2
- Output: [2,1,4,3,5]
Candidate's Approach
-
For Trapping Rain Water:
- Solved using O(n) time and space complexity.
- Interviewer insisted on an O(1) space solution.
-
For Reverse Linked List in K Groups:
- Solved using O(k) space and O(n) time complexity.
- Interviewer insisted on an O(1) space solution.
Interviewer's Feedback
No feedback provided.