Coding & Algorithms Interview Questions

Practice 3,469 real Coding & Algorithms interview questions for 2026. Covers companies like Meta, Amazon, Google, Uber, and Microsoft. Real questions from actual interviews with detailed solutions — ideal for focused interview preparation. Coding & Algorithms interview questions are the single most common technical gate for software engineering roles and are used to evaluate problem framing, algorithm selection, complexity trade-offs, correctness, edge-case reasoning, and clear communication under time pressure. Expect this category to appear in early technical screens and repeatedly across onsite loops at companies that weight it heavily (notably Meta, Google, and Amazon). Interviews will test arrays and strings, trees and graphs, dynamic programming, hashing and two‑pointer techniques, and the candidate’s ability to test and optimize code in a shared editor. Prepare with timed mock interviews, practice in the same editor you’ll use live, and build a progressive schedule that moves from fundamentals to medium/hard problems; typical candidates invest several weeks to a few months of focused practice depending on seniority and target company.

3.5k Questions 368 Companies08.11.2026
Showing 20 results
Role
Mavensecurities logo
Mavensecurities
Medium
Data Scientist

Compute probability of random arithmetic progression triple

You have the integers from 1 to 30 inclusive. You randomly choose 3 distinct numbers without replacement, and all 3-element subsets are equally likely...

Coding & Algorithms
1
0
23 people solved
Nov 20, 2025
Sigmacomputing logo
Sigmacomputing
Easy
Software Engineer

Implement a basic pivot table with totals

You are given a small in-memory table of data and are asked to implement a simplified pivot table operation and a printer for it. Assume the input dat...

Coding & Algorithms
6
0
97 people solved
Nov 20, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Find lowest common ancestor in tree

You are given the root of a binary search tree (BST) and two distinct nodes p and q that are guaranteed to exist in the tree. Task (BST case): - Find ...

Coding & Algorithms
6
0
56 people solved
Nov 19, 2025
Meta logo
Meta
Medium
Software EngineerIntern

Solve tree diameter and grid path problems

You are interviewing for a software engineer / ML intern role and are given the following algorithmic problems. --- Question 1: Longest Path in a Tree...

Coding & Algorithms
2
0
38 people solved
Nov 18, 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
19
0
172 people solved
Nov 18, 2025
Amazon logo
Amazon
Medium
Machine Learning Engineer

Design LFU cache with distributed extension

Problem You are asked to design and implement a data structure that behaves like an in-memory cache with a Least Frequently Used (LFU) eviction policy...

Coding & Algorithms
4
0
35 people solved
Nov 18, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Count integer pairs satisfying 1/x + 1/y = 1/N

You are given a positive integer N (\(1 \le N \le 10^6\)). Consider the Diophantine equation: \[ \frac{1}{x} + \frac{1}{y} = \frac{1}{N}, \] where x a...

Coding & Algorithms
6
0
56 people solved
Nov 17, 2025
Uber logo
Uber
Hard
Software Engineer

Maximize stock profit with one or two trades

You are given an array prices where prices[i] is the price of a given stock on day i (0-indexed). You want to maximize your profit by choosing when to...

Coding & Algorithms
5
0
82 people solved
Nov 17, 2025
Google logo
Google
Medium
Software Engineer

Find mode in a trinary search tree

You are given the root of a trinary search tree where each node has up to three children: `text class Node { int val; Node left; // all values ...

Coding & Algorithms
12
0
135 people solved
Nov 16, 2025
Apple logo
Apple
Easy
Data Engineer

Implement most_frequent_key without using max()

Problem (Python OOP) You are given two classes. Parent precomputes frequency counts of items (as strings) from an input list. `python class Parent: ...

Coding & Algorithms
10
0
88 people solved
Nov 16, 2025
Two Sigma logo
Two Sigma
Hard
Data ScientistIntern

Implement Univariate Linear Regression with Ordinary Least Squares

Implement univariate (simple) linear regression fitted in batch with the ordinary least squares (OLS) closed-form solution. You must implement the for...

Coding & Algorithms
0
0
4 people solved
Nov 15, 2025
Two Sigma logo
Two Sigma
Hard
Data ScientistIntern

Maximum-Product Simple Path in a Complete Directed Graph

You are given a complete directed graph with n nodes labeled 0 through n - 1. For every ordered pair of distinct nodes (i, j), there is a directed edg...

Coding & Algorithms
0
0
5 people solved
Nov 15, 2025
Two Sigma logo
Two Sigma
Hard
Data ScientistIntern

Count Distinct Island Shapes in a Binary Grid

You are given an m x n binary grid grid, where grid[i][j] is either 0 (water) or 1 (land). An island is a maximal group of 1-cells connected 4-directi...

Coding & Algorithms
0
0
7 people solved
Nov 15, 2025
Databricks logo
Databricks
Medium
Software Engineer

Compute last-5-minute QPS in memory

Problem You are building a lightweight in-memory component that tracks the query load (QPS) of a service. Design a data structure with two operations:...

Coding & Algorithms
5
0
97 people solved
Nov 14, 2025
Agoda logo
Agoda
Medium
Software Engineer

Compute triangle min path and dice stopping stats

You are given two independent interview questions. 1) Triangle minimum path sum (DP) Given a triangular array triangle with n rows, find the minimum p...

Coding & Algorithms
9
0
88 people solved
Nov 14, 2025
Salesforce logo
Salesforce
Medium
Software Engineer

Find longest subsequence of x that is a substring of y

Given two strings x and y, compute the maximum length of a string s such that: - s is a subsequence of x (can delete zero or more characters from x wi...

Coding & Algorithms
24
1
178 people solved
Nov 13, 2025
Salesforce logo
Salesforce
Medium
Software Engineer

Remove duplicates from a singly linked list

You are given the head of a singly linked list of integers. Modify the list in place so that it contains only the first occurrence of each value (i.e....

Coding & Algorithms
9
0
116 people solved
Nov 13, 2025
Meta logo
Meta
Hard
Software Engineer Locked

Guide a mouse to find cheese with APIs

This question evaluates the ability to reason about graph exploration and stateful API interaction in an unknown 2D grid, assessing competencies in se...

Coding & Algorithms
3
0
45 people solved
Nov 12, 2025
Apple logo
Apple
Medium
Machine Learning Engineer

Rotate a Matrix In Place

Given an n x n matrix of integers, rotate the matrix 90 degrees clockwise. Implement the function in Python. You may use a straightforward approach wi...

Coding & Algorithms
0
0
8 people solved
Nov 11, 2025
Uber logo
Uber
Hard
Software Engineer

Implement three interview-style coding tasks

You are given three separate coding tasks, all focused on algorithm and data-structure design. --- Task 1: Longest Bounded-Difference Subarray You are...

Coding & Algorithms
15
0
132 people solved
Nov 11, 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