Round 2
Questions:
- Given a string, return the first non-repeating character. (Simple Problem)
- Find the Median of Two Sorted Arrays
Candidate's Approach
For the second problem, I elaborated on three different approaches to solve it:
-
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)
-
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)
-
Third Approach: Apply a binary search algorithm.
- Time Complexity: O(log(min(m, n)))
- Space Complexity: O(1)
Interviewer's Feedback
No feedback provided.