Amazon Interview Question for SDE-2s
- 0of 0 votes
This was the 2nd round. Face to face. DS and Algo- uday4friendz March 04, 2016 in India for Product Details Page
Q1) Given an array 'A' of size 'n' and a number 'm' such that 'm <= n'. For all subsets of 'A' of size 'm', return the difference between the number of non-increasing and non-decreasing sub-sequences.
He asked me to write the program on paper in any language.
This is how i approached it.
1) First i gave the brute force solution and explained it to him. He liked it.
2) Then he asked for the complexity of the solution. I gave right ans.
3) Then i told him that it can be optimized by 'xyz' approach.
4) Then he asked me if i can write the solution. I said i will first explain him how it can be solved. Then if he wants me to write the code, he will have to leave me alone for some time. He agreed. I explained.
5) There was a bug in my solution. He gave a test case that exposed it. Then i rectified the bug. He accepted.
6) He said that it. He does not need the full code.
| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm
Interview Type: In-Person
Open Chat in New Window