Amazon Coding & Algorithms Interview Questions
Amazon Coding & Algorithms interview questions focus heavily on data structures, algorithmic problem solving, and clear on-the-spot implementation. What’s distinctive is the combination of speed and depth: interviewers evaluate correctness, time and space complexity, edge-case handling, and the candidate’s ability to communicate a stepwise approach under time pressure. Expect array/string manipulation, trees/graphs, hashing, dynamic programming, and occasional system- or design-lite prompts for senior roles, with behavioral ties to Amazon’s leadership principles sometimes woven into technical rounds. Typical loops begin with one or two timed phone screens followed by an onsite or virtual loop of multiple interviews that mix pure coding, design (for higher levels), and behavioral assessment; a bar-raiser may appear to ensure hiring standards. For effective interview preparation, practice timed coding problems across core topics, run mock interviews that force you to verbalize decisions, write clean, testable code, and rehearse concise STAR-style stories that highlight ownership and impact. Developing pattern recognition for problem types and routinely reviewing complexity and edge cases will make your responses faster, safer, and more persuasive.
Compute array products excluding self and top-k
Algorithms 1) Product of array except self (no division) Given an integer array nums of length n, return an array ans where: - ans[i] = product of all...
Design a weighted random value generator
Weighted random value generator Design a generic component that stores values with integer weights and can return a random value with probability prop...
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...
Implement PyTorch training loop
Implement a basic PyTorch training loop You are given a PyTorch neural network model, a DataLoader that yields (inputs, targets) batches, an optimizer...
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...
Find minimum total range-increment to sort
You are given an integer array power[0..n-1] representing computational power of n servers. You may perform the following operation any number of time...
Maximize capacity with primary-backup pairing
You are given n servers, where server i has memory capacity memory[i]. A valid system must contain an even number of servers. If the system contains 2...
Implement a high-throughput web crawler safely
Design and code (pseudocode acceptable) a multi-threaded web crawler that favors breadth-first discovery while continuously running analysis tasks on ...
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...
Solve two-sum variants at scale
Base task: Given nums = [3, 1, 2, 2, 4] and target = 4, return the 0-based index pair (i, j) with i < j such that nums[i] + nums[j] = target. If multi...
Implement decoder-only GPT-style transformer
Goal Implement a simplified decoder-only Transformer language model (similar in spirit to GPT) for next-token prediction. The implementation should be...
Implement lower_bound and upper_bound binary search
Implement two functions for a nondecreasing sorted integer array nums of length n: lower_bound(target) returns the smallest index i such that nums[i] ...
Implement K-means and solve interval/frequency tasks
Task 1 — Describe/implement K-means clustering Given: - A data matrix X with shape (n_samples, d). - An integer k (number of clusters). Explain (or wr...
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 (...
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...
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...
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...
Solve subset-count and kth-factor problems
Two Independent Tasks A) Maximum Count Under Sum Constraint You are given an integer array arr and an integer budget n. Return the maximum number of e...
Implement list overlap and dense-ranked word frequencies
Part A — Multiset overlap count Implement count_overlap(a: List[int], b: List[int]) -> int that returns the size of the multiset intersection of a and...
Design faster delay-time computation
You are given an array of integers representing task priorities. Tasks execute from right to left. For each index i, define its delay time as j - i wh...