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.

233 Questions 1 Company08.11.2026
Showing 20 results
Role
Amazon logo
Amazon
Medium
Software Engineer

Compute tree diameter

Given a (potentially large) binary tree, compute its diameter (the number of edges on the longest path between any two nodes). Implement an O(n) solut...

Coding & Algorithms
4
0
41 people solved
Sep 6, 2025
Amazon logo
Amazon
Medium
Software Engineer

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 ...

Coding & Algorithms
2
0
50 people solved
Sep 6, 2025
Amazon logo
Amazon
Medium
Software Engineer

Determine max remainders and anagram after deletions

Part 1 (Array Remainders): Given an integer array A of length n with A[i] > 0. You may choose any integer array B of length n. Define C[i] = B[i] mod ...

Coding & Algorithms
5
0
37 people solved
Sep 6, 2025
Amazon logo
Amazon
Medium
Software Engineer

Solve Two OA Algorithm Problems

The post describes two separate coding questions from an online assessment: 1. Greedy deletion by minimum value Given an integer array nums, repeate...

Coding & Algorithms
14
0
172 people solved
Jan 8, 2026
Amazon logo
Amazon
Medium
Software EngineerIntern Locked

Maximize capacity with primary-backup pairing

This question evaluates combinatorial optimization and constrained matching skills, focusing on algorithm design, complexity analysis, and resource-al...

Coding & Algorithms
5
0
48 people solved
Jan 6, 2026
Amazon logo
Amazon
Medium
Machine Learning Engineer Locked

Compute array products excluding self and top-k

This question evaluates skills in array manipulation, in-place algorithm design, numerical stability and edge-case reasoning (such as handling multipl...

Coding & Algorithms
10
0
77 people solved
Jan 6, 2026
Amazon logo
Amazon
Medium
Software Engineer Locked

Design a weighted random value generator

This question evaluates understanding of weighted random sampling, probability-proportional selection, data structures for aggregating weights, and AP...

Coding & Algorithms
7
0
103 people solved
Jan 6, 2026
Amazon logo
Amazon
Medium
Software Engineer

Find shortest subarray to restore order

Given an integer array, find the shortest contiguous segment which, if sorted in ascending order, makes the entire array non-decreasing. Return the le...

Coding & Algorithms
3
0
46 people solved
Aug 14, 2025
Amazon logo
Amazon
Medium
Software Engineer Locked

Validate a training courses catalog

This question evaluates understanding of directed graphs, cycle detection, dependency validation, and data consistency in the context of a training co...

Coding & Algorithms
4
0
47 people solved
Jan 1, 2026
Amazon logo
Amazon
Medium
Software Engineer

Implement a formatted shell script output

Implement a formatted shell script output Write a shell script named script.sh that is invoked as: ./script.sh <username> <path_of_file>. It must prin...

Coding & Algorithms
4
0
40 people solved
Aug 10, 2025
Amazon logo
Amazon
Medium
Software Engineer

Design rolling-window top-K click tracker

Design rolling-window top-K click tracker You receive a high-volume stream of click events (timestamp in ms, url). Implement a data structure with two...

Coding & Algorithms
3
0
42 people solved
Jul 31, 2025
Amazon logo
Amazon
Medium
Machine Learning EngineerSenior+

Find shortest transformation steps in a word graph

You are given two strings begin and end of the same length, and a list words of distinct strings (also same length). You can transform one string into...

Coding & Algorithms
5
0
74 people solved
Dec 15, 2025
Amazon logo
Amazon
Medium
Software Engineer

Solve interval deletion and GCD subarray problems

This Amazon online assessment contains two independent algorithm problems. For each, return the requested value, describe an efficient algorithm, and ...

Coding & Algorithms
6
1
48 people solved
Jul 16, 2025
Amazon logo
Amazon
Medium
Machine Learning Engineer

Find shortest path in a grid with obstacles

You are given a 2D grid of size m x n representing a maze. Each cell in the grid is either empty (0) or blocked (1). You are also given two coordinate...

Coding & Algorithms
5
0
66 people solved
Dec 8, 2025
Amazon logo
Amazon
Medium
Machine Learning Engineer

Find two numbers that sum to target

Given an integer array nums of length n and an integer target, return the indices (i, j) (0-based) of two distinct elements such that nums[i] + nums[j...

Coding & Algorithms
2
0
28 people solved
Nov 20, 2025
Amazon logo
Amazon
Medium
Machine Learning Engineer

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...

Coding & Algorithms
20
0
173 people solved
Nov 18, 2025
Amazon logo
Amazon
Medium
Software EngineerIntern Locked

Implement nested object path lookup

This question evaluates parsing and traversal of nested maps and arrays, robust error handling for missing keys and out-of-bounds indices, and reasoni...

Coding & Algorithms
3
0
37 people solved
Oct 31, 2025
Amazon logo
Amazon
Medium
Machine Learning Engineer

Check if adding edge creates cycle in digraph

You work with a system that stores items and directed relationships between them (for example, item A points to item B). The relationships form a dire...

Coding & Algorithms
7
0
61 people solved
Oct 26, 2025
Amazon logo
Amazon
Medium
Data Scientist

Compute array modes with ties and no-mode rule

Write a function that returns the mode(s) of an integer array. Requirements: if all values are unique, return an empty list (there is no mode); allow ...

Coding & Algorithms
3
0
32 people solved
Oct 13, 2025
Amazon logo
Amazon
Medium
Data Scientist

Solve stock, BFS path, and merge intervals

Solve three coding problems; justify complexity and corner cases. A) Best Time to Buy/Sell Stock (one transaction): Given prices[0..n-1] (integers), r...

Coding & Algorithms
4
0
36 people solved
Oct 13, 2025

Frequently Asked Questions

How difficult are Amazon Coding & Algorithms interview questions?
Amazon Coding & Algorithms interview questions typically range from medium to hard. Early screens and online assessments tend to include medium problems that test correctness, edge-case handling, and basic optimization, while onsite coding rounds push toward harder algorithmic challenges that require solid data-structure intuition, efficient designs, and careful complexity analysis. Interviewers evaluate how you reason through tradeoffs, communicate your approach, and iterate under time pressure. Preparing realistic timed practice, learning to explain constraints and invariants clearly, and polishing test-case coverage will help you reliably perform at the company’s expected difficulty level.
What does the Amazon interview process look like and where do Coding & Algorithms questions appear?
Coding and algorithmic problems appear throughout Amazon’s technical hiring funnel: they commonly start in the online assessment or phone screen and continue as core rounds during the onsite or virtual loop. Early stages focus on single-problem implementation and correctness, while later technical interviews assess algorithmic depth, optimizations, and robustness under follow-up prompts. Parallel rounds may cover system design or behavioral evaluations, but coding rounds are central for software-engineering roles and often factor heavily in hiring decisions. Expect interviews to probe both your code and your problem-solving rationale, with interviewers asking for clarifications, complexity analysis, and test cases.
How should I structure a preparation timeline for Amazon Coding & Algorithms interviews?
Plan a structured timeline that balances fundamentals, applied practice, and mock interviews. Over eight to twelve weeks you can build a strong foundation by reviewing core data structures and algorithm patterns, then transition into daily timed problem solving and focused practice on weak areas. Regularly simulate interview conditions with timed questions and live mock interviews to practice explanation and pacing. Reserve time near the end for targeted review of past mistakes, readability and testing habits, and a couple of full-loop mock interviews. Shorter intensive timelines can work, but consistency and deliberate feedback cycles accelerate readiness most effectively.
What key subtopics should I master for Coding & Algorithms interviews at Amazon?
Prioritize mastery of arrays and strings, trees and graphs (BFS/DFS, topological order), dynamic programming patterns, hashing and two-pointer techniques, heaps and priority queues, and common greedy and binary-search approaches. Understanding complexity analysis, tradeoffs between time and space, and practical implementation details like handling nulls, overflow, and edge cases is essential. Equally important are writing clean, modular code and communicating thought processes clearly while iterating from brute-force to optimized solutions. Practicing pattern recognition and learning to adapt known templates to novel problem constraints will cover most frequent question types.
What practical tips will help me stand out, and what common pitfalls should I avoid during Amazon Coding & Algorithms interviews?
Stand out by clarifying requirements up front, proposing a brute-force idea first, and then iterating toward optimizations while explaining complexity tradeoffs. Verbally walk through representative test cases, handle edge cases explicitly, and keep code readable with clear variable names and small helper functions. Manage time by setting mini-milestones: plan, code, test, and optimize. Common pitfalls include diving into code without a plan, neglecting to test edge cases, ignoring interviewer hints, and getting stuck on micro-optimizations early. Unless an interviewer permits it, avoid using external assistants during live interviews and focus on demonstrating your independent problem-solving skills.

Explore more Amazon Coding & Algorithms interview questions

Real questions from candidate reports, grouped by role, topic and company.

By role
Other categories at Amazon
Coding & Algorithms questions at other companies
Browse all