Amazon.com

www.amazon.com
Employer Engaged

Interview Question

Software Engineer II Interview Bangalore (India)

Given an large list of unsorted numbers, find the smallest

  number. You can access the list only 3 numbers at a time, and keep moving forward 1 number at a time.
Tags:
technical, data structures
Answer

Interview Answer

4 Answers

4

Otherwise called the sliding window problem

Interview Candidate on Jun 19, 2012
1

Use the selection sort and after the pass stop the iterating. Time complexity will be O(N) & only one swap.

Vasant on Jul 14, 2012
0

Use the selection sort and after the first pass stop the iterating. Time complexity will be O(N) & only one swap.

Vasant on Jul 14, 2012
0

Did they asked to write the code of the solution? or just pseudo code.And did they added any constraints? Otherwise this is pretty straight forward problem using Insertion sort.

Rishi on Sep 20, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.