- Published on
Meta | E4 | Phone Screen | Rejected
- Author
- Shared Anonymously
Questions
- Find number of unique elements in sorted array.
- Assuming optimized solution on the first question which is O(n) time and O(1) space. Can I improve O(n) even more given that, k (the number of unique elements) is much smaller than n (the size of the array)
I got the first one right. Though he had to tell me that my solution must be O(1) space and my original solution was O(n) space. I was able to quickly adjust it to O(1) space.
The second 1 I needed a lot of hints from the interviewer. Eventually, I picked up that it was binary search. I coded up something but wasn't able to verify it due to time. I figure though my idea is in the right the direction, there may be a lot of errors in my code.
Got a response saying I was not moving forward today. Bummer. I asked if I could try again after the cooling period. Not sure if that was a good idea.
Report • Mark as Helpful