Amazon Software Engineer Coding & Algorithms Interview Questions
Practice the exact questions companies are asking right now.
Compute minimum passes to collect numbers
Question You are given an array shelf of n distinct integers that is a permutation of 1…n. Starting with target = 1, you repeatedly scan shelf from le...
Compute minimum passes over permutation
Question You are given an array shelf representing a permutation of the integers 1..n. Starting with target = 1, you repeatedly scan the array left-to...
Find most frequent log user
Question You are given a list of log entries in string format, where each entry contains a username and an access timestamp separated by a delimiter (...
Solve sliding-window and heap problems
Question Design an algorithm using a sliding window to compute the maximum sum of any contiguous subarray of length k; explain time- and space-complex...
Compute maximum distinct-product pickup days
Question Given an array of positive integers representing quantities of different products, on day i (starting from 1) you must pick exactly i distinc...
Find largest island area
Question Given a 2D grid of 0s and 1s, find the largest area of a connected group of 1s (island) using 4-directional adjacency; return that area. (Var...
Minimize cost & recommend movies
Question Given arrays size[] and cost[] where size[i] is the size of the i-th product and cost[i] is the cost to increase size[i] by one unit, compute...
Solve LeetCode string and list problems
Question LeetCode 767. Reorganize String LeetCode 23. Merge k Sorted Lists LeetCode 138. Copy List with Random Pointer https://leetcode.com/problems/r...
Implement basic calculator
Question LeetCode 227. Basic Calculator II – implement an arithmetic expression evaluator supporting +, -, *, / and integer operands https://leetcode....
Determine Rounds for Star Substring Threshold
Question Given a string S, an offset array O (replacement order), and an integer M, repeatedly replace S[O[i]] with ''. Determine the minimum number o...
Solve array and list algorithms
Question LeetCode 315. Count of Smaller Numbers After Self LeetCode 23. Merge k Sorted Lists Design algorithm for Amazon Locker getPackage (retrieve p...
Solve Rotting Oranges and Bus Walk Reachability
Question LeetCode 994. Rotting Oranges. 2) Given start and end grid coordinates, an integer k (maximum walking distance), and a bidirectional graph of...
Compute minimal operations and optimal server pairing
You are given two independent coding problems. Problem 1: Minimum range-increments to make an array nondecreasing Given an integer array power of leng...
Compute peak parking lot occupancy intervals
You are given logs from a parking lot system. Each log entry has the form: [carId, time, eventType] - carId is an integer identifying a car. - time is...
Solve two set and graph problems
Implement solutions for the following two data-structure / algorithm problems. --- Problem 1: Friend-purchase recommendations You are given three enti...
Find all cells reachable by downhill flow
Problem You are given an m x n grid heights, where heights[r][c] is the elevation of cell (r, c). A drop of water is placed at a starting cell start =...
Maximize total bandwidth of data channel pairs
You are optimizing how information flows through a network of processing nodes. There are n processing nodes. The bandwidth capability of the i-th nod...
Maximize memory capacity with primary-backup servers
You are helping to optimize the capacity of a cloud system. There are n servers, where n is always even. The memory capacity of the i-th server is giv...
Minimize operations to reduce price difference
You are managing an inventory of products and want to adjust their prices. There are n products. The price of the i-th product is given by an integer ...
Check path in N-ary tree
Given the root of an N-ary tree and a sequence of integers path[0..k-1], determine whether there exists a path starting at the root whose node values ...