Round 1
Questions: WAP to find kth largest continuous subarray sum.
Initially misunderstood the problem, as the definition of this problem is incorrect. The definition of the original problem is this: Find the kth largest sum continuous subarray.
Android-related Questions:
- What is reified keyword in Kotlin: Could not answer.
- Inline functions in Kotlin: Partially answered.
- Difference between launch and async: Answered.
- Internal working of ViewModel: Answered.
- Launch modes in Android: Answered.
- Internal working of HashMap: Answered.
Candidate's Approach
- Initially proposed creating a 2D array to store the sum of each subarray, where A[1][4] would store the subarray sum from index 1 to 4.
- Optimized the approach using a Max Heap:
- Stored all subarray sums in an array.
- Built a Max Heap from the array.
- Found the kth largest element by removing k - 1 elements from the Max Heap.
Interviewer's Feedback
No feedback provided.