Amazon Interview Question

find two value sum in an array that matches a target number

Interview Answers

Anonymous

Jan 31, 2017

First iteration: scan through the list of numbers and store them in a hash array. complexity - O(n) Then scan through the list again , for every element 'i' check if (sum - i) is present? If so that is the solution if not present move on to the next element. - complexity : O(n) Total complexity: O(n)

1

Anonymous

Jun 21, 2016

as long as you finished leetcode before, this is an pretty forward question. However, the interviewer asked me to implement a hashtable when there is less than 20 minutes left to solve this problem. btw, this hashtable has to be able to handle duplicate numbers. I have been interviewing with Google and Facebook before but this interview question has no doubt the worst. I doubt if they really need an Engineer. Suggestion: if it is not that you have only one offer from Amazon and you need to work to keep your status in US, don't go there.