Amazon DS & Algo Round Interview Questions

Amazon DS & Algo Round Interview Questions

This list contains recently asked DSA questions in Amazon for SDE, SDET positions. It also includes questions from Bar Raiser rounds.

Amazon hires (and fires) lots of people and this cycle keeps repeating.

Questions do repeat, hence it is better to solve Amazon tagged questions at least 2–3 times, rather than solving a lot of new questions just once.

Doing questions multiple times will help you understand the patterns and when you see a question which is rephrased differently but has same solution, you will be able to do it.

You will be frequently asked leadership principles in behavioral questions. So prepare your stories around them. There can be long period of silences between rounds.

Wait time Between Rounds

Wait time is often the most frustrating part. No updates, no recruiter contact, just uncertainty.

One person (SDE-1) got their OA results just after two days. But when first round was scheduled, their scheduled interviewer didn't join. After this there was 14 days of silence. After round 1 again 20 days of silence.

After round 2, candidate thought he was rejected because he couldn’t solve one of the questions.

35 days passed in complete silence after that. Out of desperation, he reached out to someone at Amazon on LinkedIn, asking if they could help him get an update from his recruiter.

And that very same day, he finally got the update. Infact bar raiser was scheduled and he did very well in it. But 2 days after his interview, he received a rejection email from AUTA.

Surprisingly a few days later his HR called asking for location preferences but didn't confirm the results. However offer arrived two days later.

Hints from Interviewer/Fumbles

Many people fumble or may need some hint from interviewer. And its alright. One person was asked the below:

Longest Substring Without Repeating Characters
Longest Substring with At Most K Distinct Characters

They did well on the first question but fumbled on the second. However they coded it up correctly in the end.

They didn't receive any update after that and thought they were rejected. But they got the call 4 days later and another round was scheduled which was completely behavioral. They got selected the next day after that.

No Solution

This can lead to rejection. But not always depending on how other rounds went.

One person with 4 years of experience and interviewed for an SDE2 role. In one round they were not able to code the solution, just gave the approach. After the loops they were offered SDE-1. Downleveled but not a complete rejection.

LeetCode Questions

Below are questions with follow-ups asked during interviews.

1

Rotting Oranges With Different Connection Times

Rot spreads from rotten oranges to adjacent fresh ones, but each connection between two cells takes its own number of minutes. Return the minimum time for every fresh orange to rot, or -1 if some orange can never rot.

https://codezym.com/question/252-rotting-oranges-weighted
3

Valid Course Order with Prerequisites

Some courses must be completed before others can be taken. Return an order that completes every course, picking the smaller course number first when several are available, or an empty list if the prerequisites form a cycle.

https://codezym.com/question/336-valid-course-order
6

Minimum Starting Charge for a Warehouse Robot

A robot moves only right or down from the top-left to the bottom-right workstation, and each workstation adds or uses up battery. Find the smallest starting charge that keeps the battery at 1 or more on at least one route.

https://codezym.com/question/475-robot-min-starting-charge
7

Maximum Number of Combo Meals From Menu Sections

Split totalDishes dishes into at least two non-empty menu sections, where a combo meal picks one dish from each section. Return the most combo meals possible, which is the largest product of the section sizes.

https://codezym.com/question/491-max-combo-meals
8

Circular Buffer With Three Task Priority Levels

Design a fixed-size circular buffer where tasks of priority 1, 2 and 3 share one array, and any freed slot can be reused. Pop removes the earliest pushed task of the highest priority present, and both operations run in O(1).

https://codezym.com/question/493-priority-circular-buffer
9

Shortest Word Tile Group

Find the shortest continuous group of letter tiles whose letters can be rearranged to form the target word, repeated letters included. Return an empty string if none exists, or the leftmost group on a tie.

https://codezym.com/question/417-min-piano-hand-lifts
12

Count Number of Distinct Islands in Grid

Count the distinct island shapes in a grid of land and water, where land cells connect up, down, left and right. Two islands match only if one can be shifted onto the other, without rotating or reflecting it.

https://codezym.com/question/190-count-distinct-islands-grid
14

Check Whether URLs Are Linked Through Referrer Logs

Every log entry with a referrer creates a one-way link from the referrer page to the visited url. Check whether URL b can be reached from URL a by following one or more of these links.

https://codezym.com/question/495-linked-urls-referrer-logs
16

Check If Target URL Is Reachable by Following Links

Links between web pages can be followed in one direction only, from fromUrl to toUrl. Check whether targetUrl can be reached from startUrl by following any number of links, even when links repeat or form cycles.

https://codezym.com/question/502-target-url-reachable
17

Shortest Walk Through a Snowy Park With Shoveling

Find the fewest steps from the top-left gate to the bottom-right cocoa stand in a snowy park grid. Part 1 allows no shoveling, Part 2 allows up to shovelLimit snowy squares, and Part 3 finds the fewest squares to shovel so the walk is as short as with no snow.

https://codezym.com/question/505-snowy-park-shortest-walk
20

Train Route Fare Calculator

Add stops to one train route in travel order, where each segment between neighboring stops costs 1 in either direction. A weekday fare is the number of segments, and a weekend fare is capped at weekendFareCap.

https://codezym.com/question/431-train-route-fare-calculator
22

Improve Fire Station Coverage

A fire truck moves one cell in any direction, including diagonally, each minute. Build at most one new fire station so that the farthest neighborhood is as close as possible to its nearest station, and return that time.

https://codezym.com/question/433-improve-fire-station-coverage
24

Basic Calculator for Addition and Subtraction

Build an object-oriented calculator that evaluates a valid expression with non-negative integers, +, -, parentheses and spaces, without using eval. A minus sign can also negate, at the start of the expression or right after an opening parenthesis.

https://codezym.com/question/435-calculator-for-addition-subtraction
25

Group Students with Same Marks

Students stand in a fixed row, and one operation changes the marks of every student with one value to another value. Find the fewest records to change so that equal marks always stand together in one continuous group.

https://codezym.com/question/436-group-students-with-same-marks
31

Minimum Road Repairs Between Cities

A repair truck goes from the top-left to the bottom-right section of a road map, moving up, down, left or right. Clear sections are free and each damaged section needs one repair, so find the fewest repairs needed.

https://codezym.com/question/441-min-road-repairs
33

Currency Conversion Queries

Given exact rates like "USD,CAD,2.0", find the conversion rate between two currencies, possibly through other currencies and using rates in both directions. Return -1.0 if they aren't connected, and answer many queries as a follow-up.

https://codezym.com/question/443-currency-conversion-queries
36

Circular Delivery Route

A rider starts in zone 1 of a circular road and visits delivery stops in the given order, going either way around. Leaving each zone costs that zone's travel time, so find the minimum total travel time.

https://codezym.com/question/445-circular-delivery-route
38

Maximum Empty Charging Bays Between Vehicles

Vehicles must take charging bays with matching connector types, in arrival order, along a one-way lane. Find the largest possible number of empty bays between two consecutive vehicles in any valid assignment.

https://codezym.com/question/447-empty-charging-bays
41

Video Game Turn Slots

Children take one-slot turns on a game machine, and a child must wait waitingSlots full slots before playing again. Find the fewest slots, unused ones included, to finish every requested turn, with names compared case-insensitively.

https://codezym.com/question/450-video-game-turn-slots
43

Task Execution Order

Tasks are given as "taskId,runAt,priority", and a task with an earlier runAt runs first. On the same runAt, higher priority goes first, then the smaller taskId, so return the ids in execution order.

https://codezym.com/question/451-task-execution-order
45

Company Ownership Percentage

Companies own percentages of other companies, like "atlas,beacon,40". Find the total share of targetCompany held by ownerCompany by multiplying percentages along each path and adding up all direct and indirect paths.

https://codezym.com/question/453-company-ownership-percentage
47

Maximum Usable Cable Length

Cut chosen cable rolls, using each chosen roll fully, into exactly segmentCount segments of positive length. The longest half of the segments fail inspection, so maximize the total length of the half that passes.

https://codezym.com/question/366-max-usable-cable-length

Thank you for reading.

Wish you the best of luck for your interview prep.