Status: Software Engineer, 3+ years exp, Nagarro, India, CS B.Tech. Tier 1 College.
Position: SDE2 at Amazon
Location: Bangalore, India
Date: 18th March 2020
Virtual Interviews:
Elimination interviews. Got kicked after round 2.
Round 1.
- Print the right view of a tree (https://leetcode.com/problems/binary-tree-right-side-view/)(BFS printing queue tail(using list) at the start of each iteration)
- Minimum Matrix hop (Given start and end in 2D array, find if you can reach end from start if you can only move k distance at once in 1 of 4 directions (O(1) solution using math). Same problem but with 2D giving which marked position which you couldnt jump to(BFS from start to end))
- Word break (https://leetcode.com/problems/word-break/) - wasnt asked to write code just give solution (gave brute force answer then added memoization, interviewer was satisfied)
Round 2.
- Given an array of colors, select maximum number of item given the following conditions
- You can only select 2 positions at once and they must have the same color
- You can only select a pair if a pair outside this pair has been selected(except for the outermost such pair)
Example : R B G B G B R B
One such solution is 6 - R B G G B R
Another solution is 4 - B G G B, B B B B
the answer would be 6 since we want the maximum
I told the interviewer we can do it with DP but i knew my DP is weak and i wasnt able to answer the question.
- Climbing stairs (https://leetcode.com/problems/climbing-stairs/). This was probably a pitty question so wouldnt feel bad about the first question. I did it with O(n) time and O(n) space. He asked me if i could optimize space so i did in O(1) then he asked me if i could recognise the pattern(fibonaci) and if it was possible to do it in less than O(n) and i said i didnt know. (this might be what he was looking for https://en.wikipedia.org/wiki/Fibonacci_number#Computation_by_rounding)
The interviewer consoled me and i knew i didnt make the cut(obviously)
Got a mail that my 3rd round was canceled shortly after and a rejection mail the next morning.
I knew going in my weakness was DP and i should have worked on that. I guess its time to hit the books again. It was pretty much my first interview after college and it sure did teach me a good lesson.
Wanted to that leetcode staff and community. I started in January 2020. Practicing here has been more fun than it was in college. I've actually started liking it now which i didnt back then.
Hope this helps. Good luck to you.