Amazon Interview Question for Software Engineer / Developers


Team: Intern
Country: United States
Interview Type: Phone Interview




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

We can store each word in a trie. If the word that we are trying to insert is already available in the trie, then we go ahead and delete the word.

- Anonymous March 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

to delete word


n= no of words
m=Max(length of word)


1> first way is to pick one word and search in entire book
if u find that delete it O(m*n^2)


2> short all the word

delete repeated word O(m*nlogn)


3>create a hash of al word and store in table
if you find a wrod which is already in table delete it

O(n*m)
space O(n*m)

- NaiveCoder March 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

1) Take a linked list of words as deletion is easy compared to array.
2) Traverse the list one by one and put each word in a hash table.
3) While inserting each node check it with hash table.
4) If you already find that string delete it from list.

Time Complexity O(n) n=number of strings

- Anonymous March 16, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ash......

- Anonymous March 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Hashmap(bookID, HashSet<Word>);
for each bookID (book)
if HashSet doesn't contain word
add it
else
do not add it.
repeat

- Anonymous March 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Hashmap(bookID, HashSet<Word>);
for each bookID (book)
if HashSet doesn't contain word
add it
else
do not add it.
repeat

- taojfew March 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Trie is the right data structure..

- SuperM March 17, 2012 | 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