Coding & Algorithms Interview Questions

Practice 3,469 real coding and algorithms interview questions reported from interviews at Meta, Amazon, Google, Uber and Microsoft. The mix follows what these loops actually ask: arrays and strings, hash maps, two pointers and sliding windows, binary search, linked lists, trees and graphs, BFS and DFS, recursion and backtracking, dynamic programming, heaps and priority queues, and the occasional design-a-data-structure round. Roughly four in five are rated medium, which is where most technical screens sit; 477 are hard and cluster in onsite loops. 3,033 of them open in a console where you can run your solution against the test cases in Python, Java, C++ or JavaScript. 2,712 come from Software Engineer interviews, with the rest from Machine Learning Engineer, Data Scientist and Data Engineer loops, and 404 were set as take-home projects rather than live sessions.

3.5k Questions 368 Companies08.11.2026
Showing 20 results
Role
Meta logo
Meta
Medium
Software Engineer

Compute vertical order of a BST

Compute the vertical order traversal of a binary search tree. Define coordinates so the root is at column 0, row 0; the left child is (col−1, row+ 1) ...

Coding & Algorithms
2
0
40 people solved
Sep 6, 2025
Uber logo
Uber
Medium
Software Engineer

Simulate views on an n-ary tree

Given a rooted, ordered n-ary tree (each node has a value and an ordered list of children), simulate an observer who starts at the bottom-left, moves ...

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

Justify choosing JavaScript for interviews

If given a choice of language, why would you choose JavaScript for front-end interview coding? Compare trade-offs versus TypeScript or Python regardin...

Coding & Algorithms
6
0
48 people solved
Sep 6, 2025
Roblox logo
Roblox
Medium
Software Engineer

Detect runs and collapse a numeric grid

You are given an m x n grid of digits (0– 9). Phase 1: Find every horizontal or vertical run of length ≥ 3 consisting of the same digit. For each run,...

Coding & Algorithms
15
0
144 people solved
Sep 6, 2025
Airbnb logo
Airbnb
Medium
Software Engineer

Find minimal property set in neighborhood

You are given a list of properties, each Property(id: int, neighborhood: string, capacity: int). Given a targetNeighborhood (string) and groupSize (in...

Coding & Algorithms
31
0
285 people solved
Sep 6, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Count non-decreasing arrays by digit sums

You are given an array required_sums of length n. Count how many non-decreasing arrays result[1..n] of integers satisfy all of the following: ( 1) for...

Coding & Algorithms
5
0
62 people solved
Sep 6, 2025
BlackRock logo
BlackRock
Medium
Software Engineer

Implement sorting and set intersection with input parsing

Write two functions and explain your approach in under two minutes after coding: (A) Sorting: Implement sort_numbers(nums: List[int]) -> List[int] tha...

Coding & Algorithms
5
0
49 people solved
Sep 6, 2025
Google logo
Google
Medium
Software Engineer

Maintain k-th largest in a stream

Design and implement a class KthLargest that, given an integer k and an initial list of integers, supports: ( 1) KthLargest(k, nums): constructor; ( 2...

Coding & Algorithms
7
0
75 people solved
Sep 6, 2025
Coupang logo
Coupang
Medium
Software Engineer

Compute minimal flips connecting two islands

Given an n x n binary grid of 0s (water) and 1s (land) containing exactly two disjoint islands (cells with 1 connected 4-directionally), return the mi...

Coding & Algorithms
7
0
63 people solved
Sep 6, 2025
Lyft logo
Lyft
Medium
Software Engineer

Implement pagination and a time-versioned key-value store

Implement two coding tasks: 1) Transaction pagination: Given an in-memory collection of transaction records with fields (txn_id: string, user_id: stri...

Coding & Algorithms
7
0
116 people solved
Sep 6, 2025
Uber logo
Uber
Medium
Software Engineer

Design top-K frequency structure

Design an in-memory data structure that supports: add(x) to observe an item, inc(x) to increment its frequency, dec(x) to decrement (deleting when zer...

Coding & Algorithms
6
0
63 people solved
Sep 6, 2025
Snowflake logo
Snowflake
Medium
Software Engineer

Find longest substring with at most k distinct

Given a string s and an integer k, return the length of the longest contiguous substring that contains at most k distinct characters. Provide an O(n) ...

Coding & Algorithms
5
0
116 people solved
Sep 6, 2025
Plaid logo
Plaid
Medium
Software Engineer

Compute discounted prices in a queue

Given an integer array prices where prices[i] is the price of the i-th item in a checkout line, apply the following rule: for each i, find the first j...

Coding & Algorithms
19
0
279 people solved
Sep 6, 2025
Snowflake logo
Snowflake
Medium
Software Engineer

Schedule dependent services with layered startup

You are given N services and dependency pairs (u -> v) meaning u must start before v. 1) Produce a valid startup order if one exists; otherwise detect...

Coding & Algorithms
7
0
71 people solved
Sep 6, 2025
Snowflake logo
Snowflake
Medium
Software Engineer

Check balanced parentheses with multiple bracket types

Given a string containing only parentheses '()', determine whether it is balanced. Follow-up: extend the solution to also support '[]' and '{}' with c...

Coding & Algorithms
11
0
86 people solved
Sep 6, 2025
Bloomberg logo
Bloomberg
Medium
Software Engineer

Design variable-size LRU cache

Implement an in-memory cache with least-recently-used eviction where each entry has a variable size in bytes. The cache exposes set(key, value, size),...

Coding & Algorithms
8
0
108 people solved
Sep 6, 2025
TikTok logo
TikTok
Medium
Software Engineer

Find top-k rated nodes via traversal

You are given a finite graph (directed or undirected) with n nodes and m edges. Each node u has an integer rating r[u]. Given a starting node s and an...

Coding & Algorithms
7
0
56 people solved
Sep 6, 2025
MathWorks logo
MathWorks
Medium
Software Engineer

Maximize operations by removing target-sum pairs

Given an integer array nums and an integer T, in one operation you may remove two elements whose sum equals T. Return the maximum number of operations...

Coding & Algorithms
3
0
26 people solved
Sep 6, 2025
Amazon logo
Amazon
Medium
Software Engineer

Implement a robust shell CLI

Implement a POSIX-compliant shell script invoked as ./script.sh <username> <path_of_file> that outputs a single line formatted as "<timestamp> <licens...

Coding & Algorithms
4
0
44 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

Frequently Asked Questions

How difficult are Coding & Algorithms interview questions?
Difficulty spans a wide range: from quick easy warm-ups to multi-stage hard problems that require advanced data structures or algorithmic proofs. Most companies place a majority of live coding rounds at the medium level, with occasional hard questions used to distinguish senior candidates. Interviewers evaluate problem framing, algorithm choice, time/space complexity, clean implementation, and thoughtful testing under time pressure. Expect more conceptual depth at Google, more consistent medium-to-hard screens at Meta, and Amazon to mix coding with leadership signals. Leveling depends on role and seniority: entry-level focuses on fundamentals; senior roles emphasize design, optimizations, and tradeoffs.
Where does Coding & Algorithms appear in a typical interview loop, and which companies weight it most heavily?
Coding & Algorithms is usually the first technical hurdle: it appears in phone/online screens, followed by one or more onsite or virtual coding rounds during the loop. Typical sequences are a technical screen, two to three in-loop coding sessions, then system design or behavioral rounds. Companies that weight this category heavily include Google, Meta, and Amazon, where coding performance often determines whether you progress. Candidates commonly concentrate practice for weeks or months beforehand; most targeting large tech firms prepare intensively for 6–12 weeks, while some spend 3–6 months for deeper mastery or level changes.
How long should I prepare and how should I structure that preparation?
Plan focused, progressive practice over a realistic timeline. A practical structure is an 8–12 week block: weeks 1–2 solidify fundamentals and language fluency; weeks 3–6 target core patterns (arrays, trees, graphs, DP) with timed problem sessions and pattern tagging; weeks 7–9 emphasize mock interviews, end-to-end problem solving, and optimization tradeoffs; final weeks simulate real loops with full-length sessions and targeted weak-point drills. Candidates with less experience may extend to 12–16 weeks. Regularly review mistakes, practice communicating solutions aloud, and include at least one weekly mock interview with peer or coach feedback.
What key subtopics and patterns should I master for Coding & Algorithms interviews?
Master a consistent set of patterns and their variations: arrays and strings (two pointers, sliding window), hash maps and frequency counts, sorting and binary search, recursion and backtracking, dynamic programming, trees and traversals, graphs (BFS/DFS, shortest paths, union-find), heaps and priority queues, and greedy algorithms. Also practice complexity analysis, space-time tradeoffs, and writing bug-resistant code with tests. For higher levels, focus on amortized analysis, advanced graph algorithms, segment trees or Fenwick trees, and system-aware optimizations. Interviewers value reusable problem templates and the ability to generalize patterns to new prompts.
What are standout tips and common pitfalls to avoid in Coding & Algorithms interviews?
Start by clarifying requirements and constraints, then outline your approach before coding. Write a correct, readable baseline solution first, then iterate to improve complexity while narrating tradeoffs. Test with simple and edge cases, and handle nulls, off-by-one, and empty inputs explicitly. Communicate continuously; silence looks like confusion. Avoid premature optimization, overcomplicating solutions, or ignoring interviewer hints. Time management matters: if stuck, discuss alternate approaches and code a partial solution. Finally, practice mock interviews to reduce anxiety and build the habit of clear, structured explanations under pressure.

Explore more Coding & Algorithms interview questions

Jump straight to Coding & Algorithms questions at a specific company or for a specific role.

By company
By role