✅Goldman Sachs Interview Experience || 2nd Round || CoderPad
Anonymous User
355

Hi Leetcode Community,

Today I participated in the Round-2 (CoderPad) interview, where I was presented with two coding problems: one easy and one Leetcode hard problem, to be solved within 1 hour.

Problem 1: Given a string, return the first non-repeating character. (Simple Problem)

Problem 2: Find the Median of Two Sorted Arrays

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

  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)

Waiting for the next round interview call:)

Comments (1)