Amazon Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Phone Interview




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

You have to do your egrep <pattern> <filename> | sort | uniq

egrep sees only one line at a time, it cannot know whether it's unique among other lines. 'sort' will put duplicate next to each other (as a side effect of sorting), and 'uniq' expects that, and efficiently outputs only one of a series of adjacent duplicates.

- JeffD April 05, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

cat file| sort | uniq | grep "pattern"

- satish April 05, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think he was looking if I could come up with some logical pattern, or a direction of approach, after i explained the logic to him he seemed not to care much about sort or unique.

- An April 05, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

cat filename |  tr '\t ' '\n\n' | grep "^[0-9][0-9]*$" |  sort | uniq -u

run this in a loop for each filename in the pattern

- Ravi April 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

cat filename | zgrep -i pattern | sort -n | uniq -c

- Sivaraj June 24, 2014 | 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