Recently, I interviewed with eBay for a Software Engineer role. The first round was a coding round on CodeSignal consisting of two questions.
Similar LeetCode: https://leetcode.com/problems/merge-k-sorted-lists/
My initial solution was to insert all elements into a min-heap and pop the smallest element k times. The interviewer accepted the implementation but later pointed out that it wasn't optimal.
I then optimized it by maintaining one pointer/index for each sorted array. Both visible test cases passed.
LeetCode 33: https://leetcode.com/problems/search-in-rotated-sorted-array/
I initially proposed the two-step approach:
The interviewer asked for the optimal single-pass binary search solution instead.
I implemented it, but I wasn't fully confident. The code passed the visible test cases, but I knew there were edge cases I hadn't verified.
The interviewer pointed out two improvements:
Use mid = start + (end - start) / 2 instead of (start + end) / 2 to avoid integer overflow.
Return immediately when the target is found instead of storing the index and returning it later.
Unfortunately, This single pass approach I could not complete.
I was rejected after the first round. The recruiter mentioned that I wasn't able to arrive at the optimal solution for both questions.
If you're interviewing at eBay, expect the interviewer to look beyond passing the visible test cases. They evaluate often by manually dry-running your code. If an optimal solution exists, implement it - take care of all smaller details like Integer overflow etc - I was rejected due to this.