Amazon Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

If the set of integers is known, then the problem becomes simple.

If the set of integers is known:
Have a hash of the known set of integers. Parse the input stream, hash it to get the key and increase its corresponding value.

If the set of integers is unknown:
Use a linked list instead of an array for your hash.

- ola April 19, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Linked List?? If you're reading from a stream, you're gonna traverse the linked list every time you read an integer from the stream to check and possibly update the occurrence of that integer? Grossly inefficient isn't it?

- pops August 09, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Have a hash map with key as the integer value and value to be the count.

integer - count

keep hashing all the values that are obtained. if entry already exist, increment it else add a new entry.

- Ram August 13, 2007 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

If the set of integers is unknown, the hashmap may not always suffice for memory constraints. Use a BST instead.

- tb February 10, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I dont see any benefit of using BST here. We can use trie based on digits.

- Anonymous September 11, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Dynamic Hash table?

- lele August 23, 2009 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More