Amazon Coding & Algorithms Interview Questions
Master your tech interview with our curated database of real questions from top companies.
Generate Synthetic Clickstream Data with Python Function
Scenario The analytics team needs to generate synthetic click-stream records to test a new reporting pipeline before real traffic arrives. Question Wr...
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...
Solve Search Insert Position Using Binary Search
Scenario Live coding round for an Amazon Applied Scientist position; candidate must solve LeetCode 35 (Search Insert Position) without helper librarie...
Calculate 7-Day Rolling Average for Energy Consumption
Scenario Hiring manager wants a quick coding exercise to verify programming fluency. Question Write a Python function that takes a list of daily energ...
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...
Identify Number Pairs Adding to Target in Array
Scenario Coding round to identify all number pairs that add up to a target in an array containing duplicates. Question Given an integer array (may con...
Implement Reservoir Sampling; Analyze Time and Space Complexity
Scenario Process an unbounded stream of user IDs and maintain a uniform random sample of k users in memory. Question Implement reservoir sampling for ...
Determine Maximum Path Length in Directed Acyclic Graph
Scenario A backend service represents task dependencies as a directed graph; you need to understand how deep the longest dependency chain can get. Que...
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...
Design a Scalable, Fault-Tolerant Distributed Order System
Scenario Round covering distributed-system design and algorithm implementation. Question Design a highly available, low-latency distributed order-proc...
Implement and Analyze 'Merge k Sorted Lists' Algorithm
Scenario Algorithm coding challenge during the final interview round. Question Implement LeetCode 23 ‘Merge k Sorted Lists’ and explain your complexit...
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...
Implement Function to Determine Mode and Prime Numbers
Scenario Implementing utility algorithms within a data-processing library. Question Write a function that returns the mode of an integer list; if all ...
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...
Implement BFS to Find Shortest Path in Graph
Scenario Social network needs to compute the shortest friend-distance between two users in an undirected graph containing millions of nodes. Question ...
Implement basic calculator
Question LeetCode 227. Basic Calculator II – implement an arithmetic expression evaluator supporting +, -, *, / and integer operands https://leetcode....
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...
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...