I just completed my Meta onsite interviews with two coding rounds. Here's how they went:
Question 1: Find the number of connections needed to connect all computers.
Input: [[a,b],[b,c],[d,e]]
Output: 1
Solution: Solved this using DFS.
Question 2: Perform string multiplication.
Input: a = "10", b = "5"
Output: "50"
Unfortunately, I couldn't solve this one.
Question 3: Find a random index of the maximum value in an array.
Input: [1, 2, -1, 4, 5, 5]
Output: Randomly return one of the indices for 4 or 5.
Solved this optimally.
Question 4: Implement insert() and getMedian() for a sorted list.
Input: insert(3), insert(1), insert(2)
Output: getMedian() = 2
Initially solved by sorting the list after every insertion but later optimized it by maintaining the middle value(s).
What do you think? Is there still hope for me?