Amazon Interview Question for SDE1s


Country: India
Interview Type: Written Test




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

tr -d '\012' < {file} | awk -F '' ' { for(i=1; i<= NF; i++) A[substr($0,i,1)]=i } END {for (val in A) {print val } }' | tr -d '\012'

- Sandeep May 14, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

grep -e [0-9][A-Z] -e [A-Z][0-9] <filename>

- Kishore Karwa August 21, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Probably this, not entirely sure who after what :

uniq <file_name> | grep "[a-zA-Z]"

- NoOne February 08, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

More or less the same answer but i think removing duplicates AFTER filtering out the numerals is probably quicker

$grep [A-Za-z] <file> |sort -u

- Anonymous February 09, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

{cat <file_name> | grep -e [A-Za-z0-9] | uniq -u

}}

- karthik February 18, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

awk -F '' '{ for(i=1; i<=NF; i++) {print $i} }' test | sed '/^\s*$/d' | sort | uniq | echo $(tr -d '\n')

- Chris February 21, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

awk -F '' '{ for(i=1; i<=NF; i++) {print $i} }' test | sed '/^\s*$/d' | sort | uniq | echo $(tr -d '\n')

- Chris February 21, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

uniq -u <file_name> | grep -e '[0-9A-Za-z]{10}'

- Ange February 22, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

tr -d '\012' < 11   | awk -F '' ' { for(i=1; i<= NF; i++) A[substr($0,i,1)]=i } END {for (val in A) {print val } }'  |  tr -d '\012'

- Sandeep May 14, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

tr -d '\012' < {file} | awk -F '' ' { for(i=1; i<= NF; i++) A[substr($0,i,1)]=i } END {for (val in A) {print val } }' | tr -d '\012'

- SandeepSutarOra May 14, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

sed '/[[:digit]]\{10\}/ d' filename

- Pushpa June 30, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

cat test.txt | sort -u | grep "[a-zA-Z]"

- Pradeep July 27, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

##############################################
#sample.sh
#to run the script :: bash sample.sh <input file_name>
##############################################
#!/bin/bash
string=`tr -d '\n' < $1`
echo `for (( i=0;i<${#string}; i++ )); do echo ${string:i:1}; done | sort -u | tr -d '\n'`

- Kathyaini August 20, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

cat test.txt |grep -e [a-z][0-9] -e [0-9][a-z] -e [A-Z][0-9] -e [0-9][A-Z]|sort|uniq

- Suman March 22, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

grep -e "[0-9][A-Za-z]" -e "[A-Za-z][0-9]" <filename> | sort | uniq -u

- rg665n July 14, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

grep -e"[0-9][A-Z]" -e "[A-Z]" <file> | uniq

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

grep [0-9][A-Z] file_name

- Geetha June 15, 2021 | 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