Google | L4 | Bangalore | July 2021 [Reject]
Anonymous User
1208

YOE: 4.5
Current CTC: 28+2 (Fixed + stocks) in a Startup

The recruiter contacted me in June end. I asked for a month to prepare. And had my initial screening round schedule on July 25th.

Question:
For a given array which can contain duplicates, and a given number, write a method which returns the index/indices (position/s) of the given number in the array, as if the input array was sorted.

Input: [33, 22, 33, 11, 22] 22

[11, 22, 22, 33, 33] (how it would look like if it was sorted)

Output: [1, 2] (zero-based indices)

I immediately got the logic and implemented it within 5mins and dry ran with multiple cases. Then the interviewer gave a follow up. If the target number is not found, return the indices of the number which occurs the most. I solved it by keeping the count of occurences of all numbers in a hash map. Then he gave another follow up. If multiple numbers occur for the most times, return all those indices. I gave an nlog n solution for this. I couldn't think of a better solution. But interviewer was also on the same page. He said it cannot be faster than that. Then we wrapped up. He was even discussing about how further rounds would be. I was confident that I nailed this round.

But got a call from Recruiter today that I'm not good enough for L4. They can consider me for L3. And there's no opening for L3 right now. So she's gonna put my application on hold.

But I already have got an offer from a good company. The package they offered there is 42 + 8 + 2(Fixed + Bonus + stocks). So I told her that I'm gonna join that company and I don't wanna keep switching. So drop the application.

This was the weirdest thing I faced in an interview. The interviewer was friendly. He seemed satisfied with my approach and coding speed. I used proper variable names, broke the logic into smaller functions. Basically did everything I would do when I write production code. Still they think I'm not good enough for an L4.

Comments (4)