Panda Guru LogoPanda
Guru

✅Goldman Sachs Interview Experience || 2nd Round || CoderPad

Round 2

Questions:

  1. Given a string, return the first non-repeating character. (Simple Problem)
  2. Find the Median of Two Sorted Arrays
Candidate's Approach

For the second problem, I elaborated on three different approaches to solve it:

  1. First Approach: Create a new array by merging the elements from both arrays, then sort the new array and find the median.

    • Time Complexity: O((m + n) log(m + n))
    • Space Complexity: O(m + n)
  2. Second Approach: Utilize two pointers, one for each array, to create a sorted array, and then determine the median.

    • Time Complexity: O(m + n)
    • Space Complexity: O(m + n)
  3. Third Approach: Apply a binary search algorithm.

    • Time Complexity: O(log(min(m, n)))
    • Space Complexity: O(1)
Interviewer's Feedback

No feedback provided.