Panda Guru LogoPanda
Guru

Purplle - First Round(Senior Android Developer)

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:

  1. What is reified keyword in Kotlin: Could not answer.
  2. Inline functions in Kotlin: Partially answered.
  3. Difference between launch and async: Answered.
  4. Internal working of ViewModel: Answered.
  5. Launch modes in Android: Answered.
  6. 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.