Amazon Interview Question for SDE-2s


Country: India




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

One way can be to run a lightweight proxy on the load balancer that checks the source IP address against a local cache of blacklisted IP addresses which refreshes at fixed intervals asynchronously

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

your 2 liner comment is so informational

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

I assume, when asked additional questions, the interviewer would ask to implement a logic where IP can appear in either a star form (10.0.0.*) or a CIDR form (10.0.0.0/8)

One of the possible solutions will involve creating a Trie data structure with the root pointing to all the possible numbers from 1 to 254. The entire trie will have 4 levels for each of the four 8 bit fields separated by the period.

The first time when we scan the list of blocked IP or the part of the IP, we create a node to the trie node based on the IP address sections appears in the block list.

When the request comes in with IP address information, if Trie matches either the entire 4 sections of the IP address or matches with * at the end, we block the IP.

- Saurabh March 18, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Forgot to mention, the same logic can apply to IPv6 addresses

- Saurabh March 18, 2021 | Flag


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