Amazon Interview Question for SDE1s


Country: India




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

is there nay more info on this problem?
1. you could 'ping' each entry in the array and return ones that succeeded (ie are valid)
2. you could specify a pattern to check each entry against (ie can't have characters other than '.', only numbers 0-9 etc)

- confused_coder July 25, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

a = [10,50,652,842,23,95,65,21,777,852,95,21,3,1,5,5,5,1000]
i=0
l = []
while i < len(a)-3:
    if a[i] < 256 and a[i+1] < 256 and a[i+2] < 256 and a[i+3] < 256 :
        l.append([a[i],a[i+1],a[i+2],a[i+3]])
        i = i+3
    else:
        i = i+1
print l

- Athar August 19, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Using this pattern:

^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.
([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$

- ishanshah301190 September 23, 2016 | 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