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
Atlassian logo
Atlassian
Medium
Machine Learning Engineer Locked

Compute moving and weighted averages from a stream

This question evaluates a candidate's understanding of streaming algorithms, sliding-window statistics, and resource-constrained data structure design...

Coding & Algorithms
3
0
36 people solved
Oct 15, 2025
Atlassian logo
Atlassian
Medium
Machine Learning Engineer Locked

Assign bookings to minimum tennis courts

This question evaluates interval scheduling and resource-allocation competencies, testing algorithmic and data-structure knowledge for handling time-i...

Coding & Algorithms
3
0
35 people solved
Oct 15, 2025
Pinterest logo
Pinterest
Medium
Machine Learning Engineer Locked

Solve prefix, array, and string problems

This set of problems evaluates proficiency in string and array algorithm design—covering prefix search, subsequence matching, and maximal-area computa...

Coding & Algorithms
2
0
19 people solved
Apr 9, 2025
Google logo
Google
Hard
Software EngineerNew Grad Locked

Find numbers with exactly two sum-of-squares forms

This question evaluates understanding of integer representations as sums of two squares and the ability to reason about counting distinct unordered re...

Coding & Algorithms
9
0
64 people solved
Oct 14, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Build a time-based key-value store

Problem Design a data structure that stores multiple values for the same key at different timestamps, and can retrieve the most recent value as of a g...

Coding & Algorithms
7
0
70 people solved
Oct 14, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Implement a Tic-Tac-Toe game class

Problem Implement a class that supports playing an n × n Tic-Tac-Toe game. Requirements Create a class TicTacToe(n) with: - move(row, col, player) -> ...

Coding & Algorithms
6
0
68 people solved
Oct 14, 2025
Capital One logo
Capital One
Medium
Data Scientist

Optimize invites under capacity constraints

You have n donors (n up to 100,000). For each donor i you know: p_online[i] (probability of donating if emailed), a_online[i] (expected donation condi...

Coding & Algorithms
11
0
93 people solved
Oct 13, 2025
Google logo
Google
Medium
Data Scientist

Minimize L2, L1, and quantile losses

Given an array X of n real numbers, derive the value θ that minimizes the sum of squared deviations Σ(xi−θ)² (mean) and the sum of absolute deviations...

Coding & Algorithms
7
0
64 people solved
Oct 13, 2025
Apple logo
Apple
Medium
Data Scientist

Find longest uniform substring after k replacements

Given a string s (ASCII, length up to 2e5) and integer k (0 ≤ k ≤ |s|), return the length of the longest substring that can be turned into all the sam...

Coding & Algorithms
4
0
47 people solved
Oct 13, 2025
TikTok logo
TikTok
Medium
Data Scientist

Maximize products bought under budget

Given N products and M customers, for each customer find the list of distinct products they can buy without exceeding their budget such that the numbe...

Coding & Algorithms
3
0
45 people solved
Oct 13, 2025
Citadel logo
Citadel
Medium
Data Scientist

Implement lazy unique-merge generator for sorted streams

Write a Python generator merge_unique(a, b) that lazily merges two nondecreasing iterables a and b (potentially infinite) into a single nondecreasing ...

Coding & Algorithms
10
0
92 people solved
Oct 13, 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
Dropbox logo
Dropbox
Medium
Data Scientist

Compute max island with constrained flips

Given an n×n binary grid G where 1=land and 0=water with 4-directional connectivity, return the size of the largest island achievable by flipping at m...

Coding & Algorithms
5
0
50 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
Snowflake logo
Snowflake
Medium
Data Scientist

Solve and optimize 3Sum and variants at scale

Implement a function that returns all unique triplets (i, j, k) of indices whose values sum to a target T, with strong performance and deduplication g...

Coding & Algorithms
5
0
54 people solved
Oct 13, 2025
Snowflake logo
Snowflake
Hard
Data Scientist

Implement DFS with cycle detection and topo order

Implement DFS (recursive and iterative) with topo sort, cycle detection, and timestamps You are given a directed graph G with N nodes labeled 1..N and...

Coding & Algorithms
10
0
84 people solved
Oct 13, 2025
Stripe logo
Stripe
Medium
Data Scientist

Implement streaming per-user reservoir sampling

Design and code (in Python) a streaming algorithm that ingests an unbounded event stream of tuples (user_id, event_time, event_type) and maintains, fo...

Coding & Algorithms
0
0
9 people solved
Oct 13, 2025
Yelp logo
Yelp
Medium
Data Scientist

Compute and Rank by Jaccard Similarity

Implement two functions: (1) jaccard_similarity(s1, s2) that tokenizes by splitting on any non-alphanumeric character, lowercases, treats tokens as se...

Coding & Algorithms
3
0
45 people solved
Oct 13, 2025
Microsoft logo
Microsoft
Medium
Data Scientist

Solve two-pointer, sliding-window, and string tasks

Solve the following three coding tasks: 1) Two-pointer in-place de-duplication: Given a non-decreasing integer array nums and an integer k >= 1, modif...

Coding & Algorithms
6
0
46 people solved
Oct 13, 2025
Pinterest logo
Pinterest
Medium
Data Scientist

Implement scalable prime generator

Write a function first_n_primes(n) that returns the first n prime numbers in ascending order. Constraints: - 1 ≤ n ≤ 100,000. - Aim for O(n log log n)...

Coding & Algorithms
4
0
53 people solved
Oct 13, 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