Round 1: An unsorted array is given and a number is given. You need to find the number closest to it. If multiple answers is possible give any one. Think about corner cases. I gave O(N) solution. Then he asked what if the array is sorted. Expected time complexity is O(logN) without using any other class or struct. Note: I missed corner case where numbers are repeating when he had asked whether you are missing any corner cases. Code was written on collabedit Code was dry run not actual compliation
Round 2: In a bucket there are oranges (Think like a graph). And there is a bad orange. All the oranges surrounding a bad orange get bad in one day. How many days will it take to all oranges get bad. I wrote code for this As time was left he asked another variation in this but no code required for it.If we had an antidote which saves an orange from getting bad for one more day. What will be the strategy to select the orange for which you will give the Antidote to increase the overall number of days for all oranges to get bad. Of course you can't give it to the first bad orange. Note : Code was written on collabedit Code was dry run not actual compliation
Round 3 (KIND OF DESIGN): Asked to design functions(consumeData, getMedian) for a problem same as finding running median then implement them. I gave heap solution.In this I was asked to code on my choice of IDE but the code was not be build and run. Main things that were checked in my opinion were Your coding skills like how you write classes, function names, comments. And of course the logic as well. This code was sent to the interviewer.I didn't even implement both the heaps though almost implemented one of them only skeleton code was required. He wanted to see what all apis I expose from heap and how I implemented those whether I was handling null pointer and other exceptions that could come.Note: Not proper try catch code was written just those cases were handled in code.
Round 4 (HIRING MANAGER): Full resume scan. Architecture of any project that you found most challenging. What you did in it. Design Typeahead. Think of google scale. (Storage, precomputation were some points discussed)Behavioural Questions: How you handled disagreement with your manager. Why marks low in college. Why Microsoft. Ok with hyd location.He also asked about past companies whether I got any promotions previously or not. And then my current rank I explained Associate was above analyst similar to SDE2. One simple coding question as well in notepad specifically and not in IDE was asked to share screen. Given an array shift all zeros to left by making the least number of assignments (or swaps) and return the number of non zero elements Eg: 1 0 2 0 5 0 0 3 6. one possible solution 1 3 2 6 5 0 0 0 and 5 is the number of non zero elementsSwap 3 with 1st 0 and 6 with 2nd 0 so that you do min swaps