Blind 75 Sheet: Complete Questions, Solutions & Tracker
The Blind 75 is a list of 75 LeetCode problems that cover the patterns coding interviews keep returning to. Here it is in its original groups. Every one of the 75 links to a FaangPrep lesson that steps through the solution visually.
Working through it by pattern rather than in list order usually sticks better: see the patterns cheat sheet for a template per pattern, or the DSA 75 sheet, our own pattern-wise list with a visualizer for every problem. Finished all 75? The NeetCode 150 adds 75 more problems in the same patterns, and Grind 75 is the same author's newer list, laid out week by week.
Every problem below has its key idea and time complexity in one line, so the list doubles as a revision sheet. Tick a problem when you have solved it: your progress is saved in this browser, no account needed.
Array (10)
- Two Sum
Hash map from value to index; for each number, look up target − number before storing it · O(n)
Visual solutionLeetCode - Best Time to Buy and Sell Stock
Track the lowest price so far; the best profit is the largest price − lowest so far · O(n), O(1) space
Visual solutionLeetCode - Contains Duplicate
Add each number to a set; a number already in the set is a duplicate · O(n)
Visual solutionLeetCode - Product of Array Except Self
Prefix products left to right, then multiply in suffix products right to left; no division · O(n)
Visual solutionLeetCode - Maximum Subarray
Kadane: extend the current sum or restart at this element, whichever is larger; keep the best · O(n), O(1) space
Kadane's algorithm
Visual solutionLeetCode - Maximum Product Subarray
Track the largest and smallest product ending here; a negative number swaps them · O(n), O(1) space
Visual solutionLeetCode - Find Minimum in Rotated Sorted Array
Binary search: if nums[mid] > nums[right] the minimum is to the right, otherwise at mid or left · O(log n)
Visual solutionLeetCode - Search in Rotated Sorted Array
Binary search: one half is always sorted; check whether the target lies in it and keep that half · O(log n)
Visual solutionLeetCode - 3Sum
Sort, fix one number, then two pointers on the rest; skip equal values to avoid duplicate triplets · O(n²)
Visual solutionLeetCode - Container With Most Water
Pointers at both ends: record the area, then move the shorter side inward · O(n)
Visual solutionLeetCode
Binary (5)
- Sum of Two Integers
XOR gives the sum without carries, AND shifted left gives the carry; repeat until the carry is 0 · O(32)
Visual solutionLeetCode - Number of 1 Bits
Clear the lowest set bit with n & (n − 1) and count how many times · O(set bits)
Visual solutionLeetCode - Counting Bits
bits[i] = bits[i >> 1] + (i & 1) · O(n)
Visual solutionLeetCode - Missing Number
XOR every index 0..n with every number (or subtract the sum from n(n + 1) / 2) · O(n), O(1) space
Visual solutionLeetCode - Reverse Bits
Shift the result left and add the lowest bit of n, 32 times · O(32)
Visual solutionLeetCode
Dynamic Programming (11)
- Climbing Stairs
ways(n) = ways(n − 1) + ways(n − 2), kept in two variables · O(n), O(1) space
Visual solutionLeetCode - Coin Change
dp[a] = 1 + the minimum dp[a − coin] over all coins; unreachable amounts stay infinite · O(amount · coins)
Visual solutionLeetCode - Longest Increasing Subsequence
Keep the smallest tail for each length and binary search where each number goes · O(n log n)
Visual solutionLeetCode - Longest Common Subsequence
dp[i][j] = dp[i − 1][j − 1] + 1 on a match, else the larger of skipping one character · O(m · n)
Visual solutionLeetCode - Word Break
dp[i] is true if some dp[j] is true and s[j..i] is a dictionary word · O(n² · word check)
Visual solutionLeetCode - Combination Sum IV
dp[t] = sum of dp[t − num] over all numbers (order matters, so amounts outside, numbers inside) · O(target · n)
Visual solutionLeetCode - House Robber
dp[i] = max(dp[i − 1], dp[i − 2] + nums[i]), kept in two variables · O(n), O(1) space
Visual solutionLeetCode - House Robber II
The houses form a circle: run House Robber on all but the last and on all but the first; take the larger · O(n)
Visual solutionLeetCode - Decode Ways
dp[i] adds dp[i − 1] if the last digit is 1-9 and dp[i − 2] if the last two make 10-26 · O(n), O(1) space
Visual solutionLeetCode - Unique Paths
dp[r][c] = dp[r − 1][c] + dp[r][c − 1], or one row reused · O(m · n)
Visual solutionLeetCode - Jump Game
Greedy: track the farthest index reachable; fail if you reach an index beyond it · O(n)
Visual solutionLeetCode
Graph (8)
- Clone Graph
DFS or BFS with a map from each original node to its copy, creating copies on first visit · O(V + E)
Visual solutionLeetCode - Course Schedule
Topological sort (Kahn’s BFS on in-degrees or DFS cycle check); possible if no cycle · O(V + E)
Visual solutionLeetCode - Pacific Atlantic Water Flow
Search uphill from each ocean’s border cells; the answer is the cells both searches reach · O(m · n)
Visual solutionLeetCode - Number of Islands
Scan the grid; each unvisited land cell starts a DFS or BFS that sinks its island, count the starts · O(m · n)
Visual solutionLeetCode - Longest Consecutive Sequence
Put numbers in a set; from each number with no predecessor, count up while the next exists · O(n)
Visual solutionLeetCode - Alien Dictionary
First differing letter of each adjacent word pair gives an edge; topological sort the letters · O(total letters)
Visual solutionLeetCode - Graph Valid Tree
Exactly n − 1 edges and no cycle (union-find), so the graph is connected · O(n · α(n))
Visual solutionLeetCode - Number of Connected Components in an Undirected Graph
Union-find over the edges (or DFS); count the distinct roots · O(n + E)
Visual solutionLeetCode
Interval (5)
- Insert Interval
Copy intervals ending before the new one, merge every overlapping one into it, copy the rest · O(n)
Visual solutionLeetCode - Merge Intervals
Sort by start; extend the last merged interval when the next one overlaps, else start a new one · O(n log n)
Visual solutionLeetCode - Non-overlapping Intervals
Sort by end; keep every interval that starts at or after the last kept end and remove the rest · O(n log n)
Visual solutionLeetCode - Meeting Rooms
Sort by start; any meeting that starts before the previous one ends is a clash · O(n log n)
Visual solutionLeetCode - Meeting Rooms II
Sort by start; a min-heap of end times frees a room when the earliest end is at or before the next start · O(n log n)
Visual solutionLeetCode
Linked List (6)
- Reverse Linked List
Walk the list and point each node back at the previous one · O(n), O(1) space
Visual solutionLeetCode - Linked List Cycle
Floyd: slow moves one step, fast two; they meet if and only if there is a cycle · O(n), O(1) space
Visual solutionLeetCode - Merge Two Sorted Lists
A dummy head; repeatedly attach the smaller front node, then the leftover list · O(m + n)
Visual solutionLeetCode - Merge k Sorted Lists
Min-heap of each list’s head; pop the smallest, push its next · O(N log k)
Visual solutionLeetCode - Remove Nth Node From End of List
Move a lead pointer n steps ahead, then move both until the lead ends; unlink the next node · O(n)
Visual solutionLeetCode - Reorder List
Find the middle, reverse the second half, then interleave the two halves · O(n), O(1) space
Visual solutionLeetCode
Matrix (4)
- Set Matrix Zeroes
Use the first row and column as markers (plus two flags for themselves), then clear marked rows and columns · O(m · n), O(1) space
Visual solutionLeetCode - Spiral Matrix
Four boundaries: walk right, down, left, up, shrinking the boundary after each side · O(m · n)
Visual solutionLeetCode - Rotate Image
Transpose the matrix, then reverse each row · O(n²), in place
Visual solutionLeetCode - Word Search
DFS from each cell matching the word, marking the cell used while exploring and restoring it after · O(m · n · 4^L)
Visual solutionLeetCode
String (10)
- Longest Substring Without Repeating Characters
Sliding window with the last index of each character; jump the left edge past a repeat · O(n)
Visual solutionLeetCode - Longest Repeating Character Replacement
Window is valid while length − (count of its most frequent letter) ≤ k; shrink otherwise · O(n)
Visual solutionLeetCode - Minimum Window Substring
Expand right until every needed count is met, then shrink left while it stays met; keep the shortest · O(m + n)
Visual solutionLeetCode - Valid Anagram
Count letters of one string and subtract the other’s; all counts must end at 0 · O(n)
Visual solutionLeetCode - Group Anagrams
Key each word by its sorted letters (or a 26-count tuple) in a hash map · O(n · k log k)
Visual solutionLeetCode - Valid Parentheses
Push opening brackets; each closing bracket must match the top of the stack · O(n)
Visual solutionLeetCode - Valid Palindrome
Two pointers from both ends, skipping non-alphanumerics and comparing lowercase · O(n)
Visual solutionLeetCode - Longest Palindromic Substring
Expand around every centre (one character and between two) and keep the longest · O(n²)
Visual solutionLeetCode - Palindromic Substrings
Expand around every centre and count each palindrome found · O(n²)
Visual solutionLeetCode - Encode and Decode Strings
Prefix each string with its length and a delimiter, so any characters survive the round trip · O(total length)
Visual solutionLeetCode
Tree (14)
- Maximum Depth of Binary Tree
Depth is 1 + the larger depth of the two subtrees · O(n)
Visual solutionLeetCode - Same Tree
Both null, or equal values with equal left and right subtrees, recursively · O(n)
Visual solutionLeetCode - Invert Binary Tree
Swap the left and right child of every node, recursively or with a queue · O(n)
Visual solutionLeetCode - Binary Tree Maximum Path Sum
DFS returns the best downward path; at each node update the answer with left + node + right · O(n)
Visual solutionLeetCode - Binary Tree Level Order Traversal
BFS with a queue, processing one level (the queue’s size) at a time · O(n)
Visual solutionLeetCode - Serialize and Deserialize Binary Tree
Preorder with a marker for null children; rebuild by reading the same order back · O(n)
Visual solutionLeetCode - Subtree of Another Tree
At each node of the big tree, check Same Tree against the small one (or compare serializations) · O(m · n)
Visual solutionLeetCode - Construct Binary Tree from Preorder and Inorder Traversal
Preorder gives the root; its index in inorder splits left and right subtrees (map for O(1) lookup) · O(n)
Visual solutionLeetCode - Validate Binary Search Tree
DFS passing the allowed (low, high) range down to each node · O(n)
Visual solutionLeetCode - Kth Smallest Element in a BST
In-order traversal visits values in sorted order; stop at the kth · O(h + k)
Visual solutionLeetCode - Lowest Common Ancestor of a BST
From the root, go left if both values are smaller, right if both larger; otherwise this node · O(h)
via the binary tree version (LeetCode 236), which also solves the BST case
Visual solutionLeetCode - Implement Trie (Prefix Tree)
Nodes with child links and an end-of-word flag; insert and search walk one character at a time · O(word length)
Visual solutionLeetCode - Design Add and Search Words Data Structure
A trie; search tries every child at a "." with DFS · O(L) add, O(26^dots · L) search
Visual solutionLeetCode - Word Search II
Put the words in a trie and DFS from each cell along the trie, pruning finished branches · O(m · n · 4^L)
Visual solutionLeetCode
Heap (2)
- Top K Frequent Elements
Count with a hash map, then bucket by frequency (or a heap of size k) · O(n)
Visual solutionLeetCode - Find Median from Data Stream
A max-heap for the lower half and a min-heap for the upper half, kept balanced · O(log n) add, O(1) median
Visual solutionLeetCode
