Problems/All DSA Problems

All DSA Problems

Every DSA problem in the content tree, kept up to date automatically as new problems are added.

1383Total
1Knapsack 0/1 Optimization
medium
201 Matrix
medium
3Take 1-2-K Game
medium
4One-bit and Two-bit Characters
easy
51055. Shortest Way to Form String
medium
61056. Confusing Number
easy
71057. Campus Bikes
medium
81059. All Paths from Source Lead to Destination
medium
91060. Missing Element in Sorted Array
medium
101086. High Five
easy
111087. Brace Expansion
medium
121100. Find K-Length Substrings With No Repeated Characters
medium
131120. Maximum Average Subtree
medium
141133. Largest Unique Number
easy
151134. Armstrong Number
easy
161136. Parallel Courses
medium
171150. Check If a Number Is Majority Element in a Sorted Array
easy
181165. Single-Row Keyboard
easy
191167. Minimum Cost to Connect Sticks
medium
201180. Count Substrings with Only One Distinct Letter
easy
211197. Minimum Knight Moves
hard
221198. Find Smallest Common Element in All Rows
medium
231214. Two Sum BSTs
medium
241228. Missing Number In Arithmetic Progression
easy
251231. Divide Chocolate
hard
261236. Web Crawler
medium
271244. Design A Leaderboard
medium
281259. Handshakes That Don't Cross
hard
291265. Print Immutable Linked List in Reverse
medium
301272. Remove Interval
medium
311297. Maximum Number of Ones
hard
321426. Counting Elements
easy
331427. Perform String Shifts
easy
341429. First Unique Number
medium
351474. Delete N Nodes After M Nodes of a Linked List
easy
361490. Clone N-Ary Tree
medium
371506. Find Root of N-Ary Tree
medium
381522. Diameter of N-Ary Tree
medium
391533. Find the Index of the Large Integer
medium
401538. Guess the Majority in a Hidden Array
medium
41159. Longest Substring with At Most Two Distinct Characters
medium
42161. One Edit Distance
medium
43163. Missing Ranges
easy
44186. Reverse Words in a String II
medium
4524 Game
hard
46247. Strobogrammatic Number II
medium
47249. Group Shifted Strings
medium
48Count Univalue Subtrees
medium
49Meeting Rooms
easy
50Meeting Rooms II
medium
51Factor Combinations
medium
52255. Verify Preorder Sequence in Binary Search Tree
medium
53256. Paint House
medium
54265. Paint House II
hard
55266. Palindrome Permutation
easy
56269. Alien Dictionary
hard
57270. Closest Binary Search Tree Value
easy
58271. Encode and Decode Strings
medium
59272. Closest Binary Search Tree Value II
hard
60276. Paint Fence
medium
61277. Find the Celebrity
medium
62280. Wiggle Sort
medium
63281. Zigzag Iterator
medium
64286. Walls and Gates
medium
65298. Binary Tree Longest Consecutive Sequence
medium
66305. Number of Islands II
hard
67311. Sparse Matrix Multiplication
medium
68314. Binary Tree Vertical Order Traversal
medium
69317. Shortest Distance from All Buildings
hard
70323. Number of Connected Components in an Undirected Graph
medium
71333. Largest BST Subtree
medium
72340. Longest Substring with At Most K Distinct Characters
medium
73346. Moving Average from Data Stream
easy
74348. Design Tic-Tac-Toe
medium
75353. Design Snake Game
medium
76358. Rearrange String k Distance Apart
hard
77366. Find Leaves of Binary Tree
medium
78369. Plus One Linked List
medium
793Sum
medium
80422. Valid Word Square
easy
81428. Serialize and Deserialize N-ary Tree
hard
82431. Encode N-ary Tree to Binary Tree
hard
83439. Ternary Expression Parser
medium
84484. Find Permutation
medium
85487. Max Consecutive Ones II
medium
86490. The Maze
medium
87499. The Maze III
hard
88505. The Maze II
medium
89531. Lonely Pixel I
medium
90545. Boundary of Binary Tree
medium
91549. Binary Tree Longest Consecutive Sequence II
medium
92582. Kill Process
medium
93588. Design In-Memory File System
hard
9459. Spiral Matrix II
medium
95604. Design Compressed String Iterator
easy
96616. Add Bold Tag in String
medium
97624. Maximum Distance in Arrays
medium
98642. Design Search Autocomplete System
hard
99644. Maximum Average Subarray II
hard
100651. 4 Keys Keyboard
medium
101694. Number of Distinct Islands
medium
102708. Insert into a Sorted Circular Linked List
medium
103716. Max Stack
hard
104723. Candy Crush
medium
105734. Sentence Similarity
easy
106760. Find Anagram Mappings
easy
107772. Basic Calculator III
hard
108A 2D parity check for 64 bits arranges them in an 8×8 array. Comment on SEC-DED capability.
medium
109A Stone Game
easy
110(a) Show that an STGC is necessarily balanced. (b) Find a balanced Gray code for n = 3.
medium
111ABC033D Triangle Classification
hard
112Accounts Merge
medium
113Add Binary Strings
easy
114Add Two Numbers
medium
115Add Two Numbers Linked List
medium
116Adding Spaces to String
medium
117Additive Number
medium
118Again for random 32-bit words, what is the average length of the shortest contiguous string of 1's?
medium
119Alice and Bob Flower Game
medium
120Alien Dictionary
hard
121All Nodes Distance K in Binary Tree
medium
122All-pairs shortest paths on a line: simple O(n²) algorithm for a line graph.
medium
123All-pairs shortest paths with matrix multiplication: worst-case O(V³ lg V).
medium
124All Paths From Source to Target
medium
125Almost Rectangle
easy
126Alternating paths and Euler trails: find Euler tour in a directed graph.
medium
127Alternative analysis of RANDOMIZED-SELECT using indicator variables.
medium
128Ambiguous Coordinates
medium
129Amortized weight-balanced trees: analyze weight-balanced BST operations.
medium
130Amount of New Area Painted Each Day
hard
131Amr and Pins
medium
132Analysis of bit operations in the Euclidean algorithm.
medium
133Analysis of d-ary heaps.
medium
134Analysis of graph connectivity: use union-find offline.
medium
135Analyze complexity of VCG payments computation
medium
136Analyze number of recursive calls in Karatsuba for n-digit input
medium
137Analyze time complexity of nested loops
easy
138Android Unlock Patterns
medium
139Another Game
easy
140Apply color-coding for path of length k in O(2^k n^{O(1)})
hard
141Apply Gray(s) before the interleaved-bits transformation. Sketch for n = 3. Is locality improved?
medium
142Apply local search to max-cut: flip vertices to improve
medium
143Apply master theorem to divide-and-conquer recurrences
medium
144Approximating MAX-CUT: analyze randomized and derandomized algorithms.
medium
145Approximating the size of a maximum clique: semidefinite programming.
medium
146Are the parallel prefix and suffix (XOR) operations invertible? If so, how to compute the inverse?
medium
147Area of Rectangles
medium
148Arpa and an exam about geometry
medium
149Arrange by growth: n log n, n^2, 2^n, log n!, n^0.5, log^2 n
easy
150Articulation points, bridges, biconnected components.
medium
151Assign Cookies
easy
152Asymptotic behavior of polynomials.
medium
153Asymptotic notation properties.
medium
154Average node depth in a randomly built BST.
medium
155Average of Levels in Binary Tree
easy
156Average sorting: sort by averages of k consecutive elements.
medium
157844. Backspace String Compare
easy
158Bad Triangle
medium
159Bag of Mice Game
hard
160Balanced Binary Tree
easy
161Balanced K-Factor Decomposition
medium
162Basic Calculator
hard
163Count Vessels in a Service-Footprint Grid
medium
164Beautiful Arrangement
medium
165Bellman Ford Algorithm
medium
166Best Position for a Service Centre
hard
167Best Time to Buy and Sell Stock
easy
168Best Time to Buy and Sell Stock II
medium
169Best Time to Buy and Sell Stock III
hard
170Best Time to Buy and Sell Stock IV
hard
171Best Time to Buy and Sell Stock with Cooldown
medium
172Best Time to Buy and Sell Stock with Transaction Fee
medium
173Breadth First Search Traversal
easy
174Bicycle Race
medium
175Bin packing: analyze First-Fit and Best-Fit decreasing algorithms.
medium
176Binary Gap
easy
177Alternating Bits Check
easy
178Binary Prefix Divisible By 5
easy
179Binary Search
easy
180Binary Search Tree Iterator
medium
181Binary search trees with equal keys: handle duplicate keys efficiently.
medium
182Inorder Traversal
easy
183Binary Tree Level Order Traversal
medium
184Binary Tree Maximum Path Sum
hard
185Binary Tree Paths
easy
186Postorder Traversal
easy
187Preorder Traversal
easy
188Binary Tree Right Side View
medium
189Binary Tree Zigzag Level Order Traversal
medium
190Binary Watch
easy
191Birthday
medium
192Bitonic Euclidean traveling-salesman problem: find shortest bitonic TSP tour.
medium
193Range AND Query
medium
194Bitwise OR of Adjacent Elements
easy
195Bitwise ORs of Subarrays
medium
196Find XOR of All Pairings
medium
197Blackslex and Girls
medium
198Bold Words in String
medium
199Bovine Dilemma
easy
200Box Rotation Simulation
medium
201Brace Expansion
medium
202Brace Expansion II
hard
203Build Array With Stack Ops
easy
204Build truth tables for basic logical operators
easy
205Deployment Code Feedback
medium
206Burst Balloons
hard
207Buttons Game
easy
208Calculate Compressed Mean
easy
209Camelcase Matching
medium
210Campus Bikes II
medium
211Can I Win
medium
212Can Make Palindrome from Substring
medium
213Can Place Flowers
easy
214Can the ten non-constant binary Boolean functions be computed with fewer than eight opcodes?
medium
215Candy
hard
216Card Match Game
medium
217Cat and Mouse
hard
218CCW
medium
219Celebrity Identification
medium
220Chalkboard XOR Game
hard
221Cheapest Flights Within K Stops
medium
222Check if a point is inside a circle
easy
223Check All Binary Codes of Size K
medium
224Check Trailing Zeros in OR
easy
225Check If It Is a Straight Line
easy
226Check if points are collinear
easy
227Check if right angled triangle from coordinates
medium
228Equal 0s and 1s Signal Route in a Binary Grid
medium
229Configuration Slot Crossword
medium
230Cherry Pickup II
hard
231Chessboard Game
easy
232Chip Take-Away
medium
233Chip testing: find a good chip using pairwise tests.
medium
234Chocolate Removal Game
medium
235Cinema Seat Allocation
medium
236Circle and Rectangle Overlapping
medium
237Circle Game
hard
238Circular Permutation in Binary
medium
239Circular Sentence
easy
240Classify: sorting, MST, max clique, 3-coloring, shortest path as P or NP-complete
easy
241Clear Digits From String
easy
242Climbing Stairs
easy
243Clone Graph
medium
244Closest Dessert Cost
medium
245Closest Watched Node on a Network Route
hard
246Closest Pair of Points
hard
247Codeforces Heuristic Contest 001
medium
248Coin Change
medium
249Coin Change II
medium
250Coin Take Game
medium
251Coin Flip Game
easy
252Collinear Points
easy
253Collinearity (ABC181C)
easy
254Combination Sum
medium
255Combination Sum II
medium
256Combination Sum III
medium
257Combination Sum IV
medium
258Combinations
medium
259Comparison of running times: for each function f(n) and time t, find the largest n solvable.
medium
260Base-10 Complement
easy
261Complex multiplication (a+bi)(c+di) = ac−bd + (ad+bc)i can be done with only three multiplications. Show how.
medium
262Compute edit distance kitten->sitting, show alignment
easy
263Compute max-weight independent set in path [1,4,5,4] via DP
easy
264Compute optimal bits for message from character frequencies
easy
265Compute transitive closure via Floyd-Warshall
medium
266Concatenated Words
hard
267Concat Binary Numbers
medium
268Confusing Number II
hard
269Connecting Cities With Minimum Cost
medium
270Consecutive Characters
easy
271Construct Binary Tree from Inorder and Postorder Traversal
medium
272Construct Binary Tree from Preorder and Inorder Traversal
medium
273Construct counterexample where Dijkstra fails with negative weights
easy
274Construct Quad Tree
medium
275Construct Smallest Number From DI String
medium
276Construct the Lexicographically Largest Valid Sequence
medium
2773314. Construct the Minimum Bitwise Array I
easy
2783315. Construct the Minimum Bitwise Array II
medium
279Container With Most Water
medium
280Contains Duplicate
easy
281Contains Duplicate II
easy
282Continuous Subarray Sum
medium
283Convert to Hexadecimal
easy
284Convert Binary Linked List
easy
285Convert English sentences to predicate logic
medium
286Convert Number Words to Digits
medium
287Convert Sorted Array to Binary Search Tree
easy
288Convex Hull (Graham Scan)
hard
289Convex Polygon
medium
290Convex Shape
medium
291Copy List with Random Pointer
medium
292Correctness of bubblesort.
medium
293Correctness of Horner's rule for evaluating polynomials.
medium
294Count Complete Tree Nodes
easy
295Count Max Frequency
easy
296Count Good Meals
medium
297Count Lattice Points Inside a Circle
medium
298Count Nice Pairs
medium
299Count Max Bitwise-OR Subsets
medium
300Count Number of Trapezoids I
medium
301Count Number of Trapezoids II
hard
302Count Numbers with Unique Digits
medium
303Queue-Rank Census - Count of Smaller Numbers After Self
hard
304Count Pairs of Similar Strings
easy
305Complete Day Pairs
easy
306Count Pairs With XOR in Range
hard
307Count Prefix and Suffix Pairs I
easy
308Count Prefix and Suffix Pairs II
hard
309Count Right Triangles in Grid
medium
310Count Square Sum Triples
easy
311Count Subarrays With Max Element Constraint
medium
312Count Subtrees Max Distance
hard
313Count the Number of Beautiful Subarrays
medium
314Count Consistent Strings
easy
315Count Fair Pairs
medium
316Count the number of possible triangles
medium
317Count Triplets Equal XOR
medium
318Count Subsets With Even XOR I
easy
319Count Subsets With Even XOR II
medium
320Count ways to arrange distinct objects
easy
321Count Ways to Build Good Strings
medium
322Count Words Obtained After Adding a Letter
medium
323Counting Bits
easy
324Course Schedule
medium
325Course Schedule II
medium
326Cover Points
medium
327Covering Points with Circles
medium
328Cow Steeplechase
medium
329Telemetry Token Coverage
hard
330Crazy Town
medium
331Critical Connections in a Network
hard
332Closest Pair of Points
hard
333Points and Minimum Distance
medium
334Cut the Triangle
easy
335Daily Temperatures
medium
336Compressed Template Decoder
medium
337Decode Ways
medium
338Decode XOR Array
easy
339Decode XOR Permutation
medium
340Define poly-time reducibility, show transitive
medium
341Define polynomial hierarchy PH, relation to P/NP
hard
342Deforestation
medium
343Delete and Earn
medium
344Delete Duplicate Folders in System
hard
345Delete Node in a Linked List
medium
346Delete Operation for Two Strings
medium
347Deleting Divisors Game
medium
348Derive Dietz's formula for the average of two unsigned integers.
medium
349Derive recurrence for Karatsuba splitting into three parts
medium
350Describe algorithm for each master theorem case
medium
351Describe FCC auction as optimization, identify NP-hard aspects
easy
352Describe in simple terms the functions (a) 2^⌊ilog2(x)⌋ and (b) 2^⌈ilog2(x−1)⌉ + 1.
medium
353Design 2-approximation for metric TSP via MST doubling
medium
354Design 2-approximation for vertex cover, prove ratio
medium
355Design a Chat Server
easy
356Design Add and Search Words Data Structure
medium
357Design algorithm to check connectivity via BFS/DFS
easy
358Design algorithm to count simple paths between two DAG vertices
medium
359Design Bloom filter, compute false positive rate for k hashes, m bits
hard
360Design BST supporting split/join in O(log n)
medium
361Design d-ary heap, analyze insert/extract-min times
medium
362Design Dijkstra variant for top-k shortest paths
hard
363Design DP for optimal BST given key probabilities
hard
364Design DP for optimal convex polygon triangulation
hard
365Design factor-2 approximation for makespan on identical machines
medium
366Design File System
medium
367Design greedy approximation for spectrum allocation
medium
368Design greedy interval scheduling for max non-overlapping intervals
easy
369Design greedy minimum platforms for train scheduling
medium
370Design hash table with constant worst-case operations (perfect hashing)
hard
371Design a Service Metrics Ranking API
medium
372Design max-spacing k-clustering using MST
medium
373Design Memory Allocator
medium
374Design O(n^2*2^n) DP for TSP using bitmask
hard
375Design O(n^2*2^n) DP TSP, run on 5-vertex complete graph
hard
376Design O(n) algorithm to check valid merge of two sorted sequences
medium
377Design QuickSort variant with O(n log n) worst-case
hard
378Design Video Sharing Platform with Reusable Media Slots
medium
379Detect Cycle in Directed Graph DFS
medium
380Detect Cycle in Undirected Graph BFS
medium
381Detect Cycle in Undirected Graph DFS
medium
382Detect Squares
medium
383Determine if n^1.001+n log n = Theta(n^1.001) or Theta(n log n)
medium
384Determine running time of various operations on arrays
easy
385Detonate the Maximum Bombs
medium
386Depth First Search Traversal
easy
387Diameter of Binary Tree
easy
388Digit Game Checker
easy
389Dijkstra Shortest Path
medium
390Distance from a point to a line
medium
391Distinct Echo Substrings
hard
392Distinct Subsequences
hard
393Distribute Repeating Integers
hard
394Divide-and-conquer multiplication of large integers: use FFT for O(n lg n).
medium
395Divide Array Into Equal Pairs
easy
396Divide Two Integers
medium
397Divisor Game
easy
398Domino and Tromino Tiling
medium
399Dynamic order statistics with binary search trees maintaining order-statistic fields.
medium
400Earliest meeting: compute the earliest meeting time in a DAG.
medium
401Earliest Unified Service Cluster
medium
402Edge-disjoint paths: find maximum number of edge-disjoint paths.
medium
403Edit Distance
medium
404Election Winner
medium
405Elimination Game
medium
406Distributed Team Capacity: Employee Free Time
hard
407Encode and Decode Strings
medium
408Encode Number
medium
409Encrypt and Decrypt Strings
hard
410Equal Substring Budget
medium
411Equation of Line
easy
412Erect the Fence
hard
413Error bounds for bagging: analyze ensemble classification error.
medium
414Escape problem: determine if there is a path for each unit to escape a grid.
medium
415Estimate Mills' constant θ and give an informal proof of Mills' theorem.
medium
416Evaluate Division
medium
417Evaluate Reverse Polish Notation
medium
418Even Number Addicts
medium
419Expected comparisons for randomized QuickSort on length n
medium
420Expected number of coin flips to get two consecutive heads
medium
421Explain co-NP vs NP, give co-NP problem examples
medium
422Explain NP-hard vs NP-complete with examples
easy
423Expression Add Operators
hard
424Stretchable Letter Groups
medium
425Extra Characters in a String
medium
426Factor Combinations
medium
427Factorial Trailing Zeroes
medium
428Fair Distribution of Cookies
medium
429Fibonacci Like Subsequence Length
medium
430Fibonacci Number
easy
431Fibonacci Series by Recursion
easy
432Deployment Rack Packing
medium
433Find a formula for the general mask mk used in the perfect outer shuffle operation.
medium
434Pantry Paths: Find Every Recipe You Can Assemble
medium
435Simultaneous String Surgery
medium
436Find counterexample where greedy coin change fails
easy
437Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree
hard
438Find Eventual Safe States
medium
439Find First and Last Position of Element in Sorted Array
medium
440Sortable Array Check
medium
441Find if Array Can Be Sorted
medium
442Find K Pairs with Smallest Sums
medium
443Kth Largest XOR Coordinate
medium
444Longest Awesome Substring
hard
445Find Maximum Area of a Triangle
medium
446Find Median from Data Stream
hard
447Find Minimum in Rotated Sorted Array
medium
448Min Time Finish All Jobs
hard
449Find Missing and Repeated Values
medium
450Find Peak Element
medium
451Find Pivot Index
easy
452Find Root of N-Ary Tree
medium
453Busiest Workers on the Edge Request Router
hard
454Find Subarrays With Equal Sum
easy
455Find the Difference
easy
456Find Duplicate in Array
medium
457Find the Index of the First Occurrence in a String
easy
458Find K-OR of Array
easy
459K-th Character in String Game I
easy
460K-th Character in String Game II
hard
461Find the Length of the Longest Common Prefix
medium
462Longest Vowel Even Substring
medium
463Find the Longest Valid Obstacle Course at Each Position
hard
464Count Winning Players
easy
465Recover Array from Prefix XOR
medium
466Prefix Common Array
medium
467Find the Punishment Number of an Integer
medium
468Find Shortest Superstring
hard
469Find the Town Judge
easy
470Partition Value Finder
medium
471Find XOR of Numbers Twice
easy
472Find Unique Binary String
medium
473Find XOR Beauty
medium
474XOR Sum of All Pairs AND
hard
475Finding the Number of Visible Mountains
medium
476First Missing Positive
hard
477First Negative Number in Every Window of Size K
medium
478Fixed Window Circular Sum
medium
479Flatten Binary Tree to Linked List
medium
480Flatten Multi-Level Linked List
medium
481Branch-Swappable Binary Trees
medium
482Flip Game II
medium
483Flipping an Image
easy
484Floyd Warshall All Pairs
hard
485For an n-way set-associative cache, what is the theoretical min number of bits for LRU?
medium
486For random 32-bit words, what is the average number of strings of 1's in x?
medium
487For SEC without correcting check bits, the rule is 2^k ≥ m + 1. What is wrong with this reasoning?
medium
488For the snoob function, let n be the length of bit strings, k the number of 1-bits. On average, how many times is the while-loop body executed?
medium
489For unsigned integers, what are the bounds on x − y if ...?
medium
490Ford-Fulkerson variations: analyze different augmenting-path choices.
medium
491Four Sum Quadruplets
medium
492Orchard Harvest Window
medium
493Fun Card Game
medium
494Game of Chips
easy
495Game of Life
medium
496Game of Matchsticks
easy
497Game of Maximization
easy
498Game of Nim
medium
499Game of Stairs
easy
500Game on Leaves
medium
501Game on Permutation
medium
502Game on Tree Easy
medium
503Game Routes
medium
504Game With Board
easy
505Game With Integers
easy
506Game With Numbers
easy
507Gas Station
medium
508Generalize Huffman to ternary codes (alphabet size 3)
hard
509Generalize Strassen for 7x7 matrices - how many multiplications?
hard
510Generalized Abbreviation
medium
511Generate Binary Strings Without Adjacent Zeros
medium
512Generate Parentheses
medium
513Generate Random Point in a Circle
medium
514Give an overflow-free method for computing the average of four unsigned integers, (a + b + c + d)/4.
medium
515Give O(n log n) algorithm for pairs (i<j) with a_i > 2*a_j
hard
516Grand Finale: Circles
medium
517Graph Valid Tree
medium
518Gray Code
medium
519Group Anagrams
medium
520Grundy's Game
medium
521Guess Number Higher or Lower II
medium
522Token Vault Probe
hard
523H-Index
medium
524Hamming Distance
easy
525Happy Number
easy
526Hashing and authentication: design a scheme resistant to adversarial keys.
medium
527Hoare partition correctness.
medium
528House Robber
medium
529House Robber II
medium
530House Robber III
medium
531How many binary Boolean instructions suffice to evaluate any n-variable Boolean function decomposed recursively?
medium
532How many multiplications to compute x²³ modulo 2^W (W = word size)?
medium
533How to convert a number in base −1+i to its negative? Extract real/imaginary parts? Conjugate?
medium
534How would you construct a three-dimensional analog of the interleaved-bits curve?
medium
535Identify NP-complete problems
medium
536Identify the Largest Outlier in an Array
medium
537Illustrate binary heap from array, perform extract-min
easy
538Implement 3-way partition QuickSort for duplicates
medium
539Implement a hash table with chaining
medium
540Implement bidirectional Dijkstra from source and destination
medium
541Implement Dijkstra with heap, analyze O((E+V) log V)
medium
542Implement DSelect with groups of 7, analyze recurrence
hard
543Implement fast I/O for your language
easy
544Implement heap priority queue for Dijkstra, analyze speedup
medium
545Implement Huffman encode/decode for text file
medium
546Implement Kadane max-sum subarray, prove correctness
easy
547Implement linear vs quadratic probing, compare clustering
medium
548Implement Magic Dictionary
medium
549Implement median-of-three pivot, analyze improvement
medium
550Implement min-heap with decrease-key in O(log n)
medium
551Implement Queue Using Array
easy
552Implement sorted set using balanced BST (AVL/RB)
medium
553Implement Stack Using Array
easy
554Implement the Chinese Remainder Theorem
medium
555Implement topological sort using DFS, detect cycles
medium
556Implement Trie II (Prefix Tree)
medium
557Implement Trie (Prefix Tree)
medium
558Implement union-find with path compression/union by rank
medium
559Independent set: prove INDEPENDENT-SET is NP-complete.
medium
560Index Pairs of a String
easy
561Industrial Nim
hard
562Insert Delete GetRandom O(1)
medium
563Insert Interval
medium
564Insert into AVL tree, perform rotations to restore balance
easy
565Insert Spaces Into String
easy
566Integer Replacement
medium
567Integer to Roman
medium
568Interleaving String
medium
569Intersection of two lines
easy
570Intersection of Two Linked Lists
easy
571Intro to Nim
easy
572Inversion of band matrices: analyze Strassen-based inversion of band matrix.
medium
573Invert Binary Tree
easy
574Investigate the locality of the interleaved-bits curve (perfect outer unshuffle). Sketch for n = 3.
medium
575IP to CIDR
medium
576IPO
hard
577Irrigation Interlock
hard
578Is Graph Bipartite?
medium
579Is Subsequence
easy
580Is there a program similar to the reciprocal sqrt routine for computing the approximate square root?
medium
581Is there a similar program for the approximate cube root of a nonnegative normal number?
medium
582Is there a similar program for the reciprocal sqrt of a double-precision float on a 64-bit machine?
medium
583Is Unique
easy
584Isomorphic Strings
easy
585Iterator for Combination
medium
586The Gem Counter's Ledger
easy
587Join operation on red-black trees: amortized analysis of RB-join.
medium
588Join operation on red-black trees: merge two BSTs with all keys in one less than the other.
medium
589Jump Game
medium
590Jump Game II
medium
591Jump Game III
medium
592K Closest Points to Origin
medium
593K Divisible Elements Subarrays
medium
594K-Nearest Neighbors
medium
595K-th Smallest in Lexicographical Order
hard
596K-th Symbol in Grammar
medium
597Keys and Rooms
medium
598khba Loves to Sleep!
medium
599Kitty and Katty
easy
600Knight Probability in Chessboard
medium
601Minimum Drain Rate for a Distributed Backlog
medium
602Kth Ancestor of Tree Node
hard
603Kth Largest Element in an Array
medium
604Kth Smallest Element in a BST
medium
605L-shapes
medium
606Largest Color Value in a Directed Graph
hard
607Largest AND Combination
medium
608Largest Perimeter Triangle
easy
609Largest Rectangle in Histogram
hard
610Largest Rectangle in Histogram
hard
611Largest Time for Given Digits
medium
612Largest Triangle Area
easy
613Lemonade Change
easy
614Length of Last Word
easy
615Let's Go Hiking
medium
616Letter Case Permutation
medium
617Letter Combinations of a Phone Number
medium
618Letter Tile Possibilities
medium
619Lexicographical Numbers
medium
620Lexicographically Smallest Equivalent String
medium
621LFU Cache Design
medium
622Activation Key Regrouping
easy
623Line Segment Intersection
medium
624Linear programming and maximum flow: formulate max flow as LP.
medium
625Linked List Cycle
easy
626Linked List Cycle II
medium
627Throttled Event Logger
easy
628Longest Arithmetic Subsequence
medium
629Longest Arithmetic Subsequence of Given Difference
medium
630Longest Common Prefix
easy
631Longest Common Prefix of K Strings After Removal
hard
632Longest Common Subsequence
medium
633Longest Common Suffix Queries
hard
634Longest Consecutive Sequence
medium
635Longest Increasing Path in a Matrix
hard
636Longest Increasing Subsequence
medium
637Longest Signal Run in the Antenna Grid
medium
638Longest Nice Subarray
medium
639Longest Nice Substring
easy
640Longest Palindromic Subsequence
medium
641Longest Palindromic Substring
medium
642Longest-probe bound for hashing: longest probe sequence in open addressing.
medium
643Longest Repeating Character Replacement
medium
644Longest String Chain
medium
645Longest Subarray With At Most K Frequency
medium
646Longest Subarray Max AND
medium
647Longest Subsequence Repeated k Times
hard
648Longest Substring With At Least K Repeating Characters
medium
649Longest Substring Without Repeating Characters
medium
650Longest Unique Substring
medium
651Longest Word in Dictionary
medium
652Longest Word With All Prefixes
medium
653Lower bound on merging sorted lists.
medium
654Lower bounds on comparison-based sorting: probabilistic lower bound.
medium
655Lowest Common Ancestor of a Binary Search Tree
easy
656Lowest Common Ancestor of a Binary Tree
medium
657LRU Cache
medium
658LRU Cache Design
medium
659Mad City
medium
660Mahmoud and a Triangle
medium
661Majority Element
easy
662Majority Element II
medium
663Majority Element Voting
medium
664Make a triangle!
easy
665Make Distinct Characters Equal
medium
666Make XOR of All Segments Zero
hard
667Making Shapes
hard
668Manhattan Distance
easy
669Manhattan Triangle
hard
670Map Sum Pairs
medium
671Matchsticks to Square
medium
672Matrix Chain Multiplication Cost
hard
673Matrix Game
easy
674Matrix Zero Conversion
medium
675Max Area of Island
medium
676Max Area Rectangle With Point Constraints I
hard
677Max Area Rectangle With Point Constraints II
hard
678Max Frequency Element Window
medium
679Max of Min for Every Window
medium
680Max Number of Fish in a Grid
medium
681Max Points on a Line
hard
682Max Score After Split
medium
683Max Sum Three Subarrays
medium
684Max Vowels in Window
medium
685Maximal Network Rank
medium
686Maximal Rectangle
hard
687Maximal Square
medium
688Maximize Distance to Closest Person
medium
689Maximize Exam Confusion
medium
690Maximize Grid Happiness
hard
691Maximize Score After N Operations
hard
692Max AND Sum of Array
hard
693Maximum bipartite matching: show equivalence to max flow in unit-capacity networks.
medium
694Maximum bipartite matching via max flow: implement Hopcroft-Karp-like algorithm.
medium
695Max Compatibility Score
medium
696Maximum Consecutive Ones
medium
697Maximum Depth of Binary Tree
easy
698Maximum Genetic Difference Query
hard
699Max Good People Statements
hard
700Max Length Concat Unique Chars
medium
701Maximum Length of Pair Chain
medium
702Max Transfer Requests
hard
703Maximum Number of Darts Inside a Circular Dartboard
hard
704Max Groups Fresh Donuts
hard
705Max Groups Increasing Length
hard
706Max Integers From Range
medium
707Max Points with Cost
medium
708Max Robots in Budget
hard
709Max Routes With Budget
hard
710Maximum Number of Visible Points
hard
711Max OR Value
medium
712Maximum Path Quality of a Graph
hard
713Max Points in Archery
medium
714Max Possible Binary Concatenation
medium
715Max Palindromic Product
medium
716Max Product of Word Lengths
medium
717Maximum Product Subarray
medium
718Maximum Profit Job Scheduling
hard
719Max Rows Covered by Columns
medium
720Maximum Node Sequence Score
hard
721Max Score Words Formed
hard
722Maximum Split of Positive Even Integers
medium
723Maximum Strength of a Group
medium
724Maximum Strong Pair XOR I
easy
725Max Strong Pair XOR II
hard
726Max Students Taking Exam
hard
727Maximum Subarray
medium
728Maximum Subarray XOR with Bounded Range
hard
729Maximum Sum Circular Subarray
medium
730Maximum Sum Increasing Subsequence
medium
731Maximum Sum Subarray of Size K
easy
732Max XOR After Operations
medium
733Maximum XOR Per Query
medium
734Max XOR Non-Overlapping Subarrays
hard
735Maximum XOR of Two Non-Overlapping Subtrees
hard
736Max XOR of Two Numbers
medium
737Max XOR With Element From Array
hard
738Median of Two Sorted Arrays
hard
739Meeting Rooms
easy
740Meeting Rooms II
medium
741Worker Pool Scheduler
hard
742Merge Intervals
medium
743Merge k Sorted Lists
hard
744Merge Overlapping Intervals
medium
745Merge Sorted Array
easy
746Merge Sorted Linked Lists
medium
747Merge Two Sorted Lists
easy
748Mergeable heaps using linked lists: implement mergeable heaps.
medium
749Find Middle Node
easy
750Min Cost Climbing Stairs
easy
751Min Cost to Connect All Points
medium
752Min Stack
medium
753Min Stack Design
medium
754Minimize Manhattan Distances
hard
755Priority Grid: Minimize the Maximum Value
hard
756Minimize OR Remaining
hard
757Minimize XOR Value
medium
758Minimum Absolute Difference in BST
easy
759Minimum Absolute Sum Difference
medium
760Minimum Area Rectangle
medium
761Minimum Area Rectangle II
medium
762Minimum Array End
medium
763Minimum ASCII Delete Sum for Two Strings
medium
764Minimum Bit Flips
easy
765Alternating Binary String
easy
766Minimum Cost For Tickets
medium
767Min Cost Connect Groups
hard
768Minimum Cost to Convert String II
hard
769Distributed Contractor Allocation
hard
770Minimum Cost to Set Cooking Time
medium
771Minimum Cost Tree From Leaf Values
medium
772Minimum Covering Substring
medium
773Minimum Cuts to Divide a Circle
easy
774Minimum Distance
easy
775Minimum Distance Between BST Nodes
easy
776Minimum Enclosing Circle
hard
777Minimum Falling Path Sum
medium
778Minimum Policy Flips in a Binary Expression Tree
hard
779Minimum Flips to Make a OR b Equal to c
medium
780Minimum-gap: maintain the minimum difference between any two numbers in a set.
medium
781Minimum Genetic Mutation
medium
782Min Incompatibility
hard
783Minimum Insertion Steps to Make a String Palindrome
medium
784Minimum Lines to Represent a Line Chart
medium
785Minimum Moves to Equal Array Elements II
medium
786Min Moves Spread Stones
medium
787Minimum Number Game
easy
788Minimum Number of Arrows to Burst Balloons
medium
789Min Flips Matrix to Zero
hard
790Min Flips Binary Grid Palindromic
medium
791Min K Consecutive Bit Flips
hard
792Minimum Number of Lines to Cover Points
medium
793Make Array XOR Equal to K
medium
794Min Ops Make Array XOR = K II
hard
795Minimum Number of Valid Strings to Form Target I
medium
796Minimum Number of Vertices to Reach All Nodes
medium
797Min Work Sessions
medium
798Min Calls to Target Array
medium
799Min One Bit Operations
hard
800Min Ops to Collect Elements
easy
801Min Ops Values Equal to K
medium
802Min Ops Binary Array to One
medium
803Min Operations to Reduce to 0
medium
804Minimum Path Sum
medium
805Minimum Recolor Window
medium
806Score After Removals
hard
807Minimum Score Triangulation of Polygon
medium
808Minimum Size Subarray Sum
medium
809Minimum Spanning Tree Kruskal
medium
810Deployment Window: Minimum Timestamp Gap
medium
811Minimum Time to Break Locks I
medium
812Min Time to Visit Cell in Grid
hard
813Minimum Time to Visit Disappearing Nodes
medium
814Minimum Time Visiting All Points
easy
815Minimum Trim Length String
medium
816Min Unique Word Abbreviation
hard
817Minimum Window Substring
hard
818Minimum XOR
medium
819Min XOR Sum of Two Arrays
hard
820Mirror Grid
medium
821Misère Nim
medium
822Missing Sequence Number
easy
823Monge arrays: implement matrix operations on an array with the Monge property.
medium
824Monotone shortest paths
medium
825More recurrence examples with various methods.
medium
826Most Server Racks Removed Through Shared Channels
medium
827Move Pieces Transformation
medium
828Multiply Strings
medium
829Calendar Gatekeeper: Accepting Non-Overlapping Reservations
medium
830My Calendar II
medium
831N-Queens
hard
832N-Queens II
hard
833N-th Tribonacci Number
easy
834Naming a Company
hard
835Nearest Exit from Entrance in Maze
medium
836Neighboring Bitwise XOR
medium
837New 21 Game
medium
838Next Closest Time
medium
839Next Greater Element Finder
easy
840Next Greater Numerically Balanced Number
medium
841Next Palindrome
hard
842The Next Lexicographic Arrangement
medium
843Next Permutation Generator
medium
844Next Smaller Element
medium
845Next Special Palindrome Number
hard
846Nice Subarrays Count
medium
847Nim Game Basics
easy
848Nim Game II
medium
849Nimble Game
medium
850NN and the Optical Illusion
medium
851Non-Decreasing Subsequences
medium
852Non-overlapping Intervals
medium
853Nullify Matrix
hard
854Number Complement
easy
855Number Elimination Game
medium
856Number Game
easy
857Popcount
easy
858Number of Bit Changes
easy
859Number of Closed Islands
medium
860Number of Connected Components in an Undirected Graph
medium
861Number of Days Between Two Dates
easy
862Number of Dice Rolls With Target Sum
medium
863Number of different binary trees on n nodes (Catalan numbers).
medium
864Number of Distinct Substrings in a String
medium
865Number of Enclaves
medium
866Even and Odd Bit Positions
easy
867Number of Excellent Pairs
hard
868Number of Good Service Paths
hard
869Number of Good Ways to Split a String
medium
870Number of Islands
medium
871Number of Islands II
hard
872Number of Longest Increasing Subsequence
medium
873Number of Matching Subsequences
medium
874Number of Provinces
medium
875Number of Rectangles That Can Form Largest Square
easy
876Number of Self-Divisible Permutations
medium
877Number of Squareful Arrays
hard
878Steps to One (Binary Reduction)
medium
879Steps to Zero
easy
880Number of Valid Move Combinations On Chessboard
hard
881Number of Valid Words for Each Puzzle
hard
882Ways to Reach After K Steps
medium
883Ways to Wear Distinct Hats
hard
884Number of Wonderful Substrings
medium
885Numbers With Same Consecutive Differences
medium
886Odd Even Jump
hard
887Of the 2ⁿ binary words of length n, how many have shortest contained string of 1's of length 1?
medium
888Offline caching (paging): design LRU and LFD cache eviction policies.
medium
889Offline minimum: find the min removed from each extraction using disjoint sets.
medium
890Ones and Zeroes
medium
891Online Book Reader
medium
892Online minimum spanning tree: competitive ratio of greedy algorithm.
medium
893Optimal Account Balancing
hard
894Optimal Strategy for a Game
medium
895Optimize Water Distribution in a Village
hard
896Ordering by asymptotic growth rates.
medium
897Othello
medium
898Out of Boundary Paths
medium
899Pacific Atlantic Water Flow
medium
900Paging against a non-oblivious adversary: lower bound analysis.
medium
901Paint House
medium
902Paint House II
hard
903Paint House III
hard
904Palindrome Game Easy
medium
905Palindrome Game Hard
hard
906Check Palindrome Linked List
easy
907Palindrome Number
easy
908Palindrome Pairs
hard
909Palindrome Partitioning
medium
910Palindrome Partitioning II
hard
911Palindrome Permutation
easy
912Palindrome Permutation II
medium
913Palindromic Substrings
medium
914Parallel Courses II
hard
915Parallel Lines
medium
916Parallel machine scheduling: formulate as difference constraints.
medium
917Parallel matrix operations: analyze span and work of matrix addition/multiplication.
medium
918Parallel merge sort: design a work-efficient parallel mergesort.
medium
919Parallel Sums
medium
920Parameter-passing costs in divide-and-conquer.
medium
921Partition Around Pivot
medium
922Partition Array for Maximum Sum
medium
923Partition Equal Subset Sum
medium
924Partition List
medium
925Partition String
medium
926Partition String Into Minimum Beautiful Substrings
medium
927Partition to K Equal Sum
medium
928Pascal Triangle Builder
easy
929Pastebin
medium
930Path Sum
easy
931Path Sum II
medium
932Path with Maximum Gold
medium
933Path with Maximum Probability
medium
934Find the Summit of a Mountain Array
medium
935Favorite Companies Subset
medium
936Perfect Rectangle
hard
937Perfect Squares
medium
938Permutation Game
medium
939Permutations
medium
940Permutations II
medium
941Permutations III
medium
942Perpendicular Segments
medium
943Persistent dynamic sets: maintain all past versions of a BST.
medium
944Persistent dynamic sets: use potential method for persistent BSTs.
medium
945Personal Financial Manager
hard
946Phone Number Prefix
easy
947Plus One
easy
948Points and Minimum Distance
easy
949Poison
hard
950Poker Nim
medium
951Polygon Area
easy
952Polygon Area (Shoelace)
easy
953Populating Next Right Pointers in Each Node II
medium
954Is Power of Four
easy
955Is Power of Three
easy
956Is Power of Two
easy
957Pow(x, n)
medium
958Predict the Winner
medium
959Prefix and Suffix Search
hard
960Prefix Matching in Sentence
easy
961Prime Set Bits
easy
962Probability of a Two Boxes Having The Same Number of Distinct Balls
hard
963Product of Array Except Self
medium
964Profitable Schemes
hard
965Project Euler #91: Right Triangles with Integer Coordinates
medium
966Projection Area of 3D Shapes
easy
967Prove 3-COLOR NP-complete from 3SAT using OR-gadget
hard
968Prove Bellman-Ford detects negative cycles from source
medium
969Prove binomial theorem
medium
970Prove by induction MergeSort sorts any array correctly
medium
971Prove Cantor's diagonal argument
hard
972Prove cut property: lightest crossing edge in every MST
medium
973Prove cycle property: heaviest cycle edge not in any MST
medium
974Prove D&C closest-pair runs in O(n log n)
medium
975Prove De Morgan's laws for logic
easy
976Prove De Morgan's laws for sets
easy
977Prove Dijkstra correct for non-negative weights
hard
978Prove Dijkstra processes vertices in non-decreasing distance
medium
979Prove every DAG has at least one source and one sink
easy
980Prove exchange lemma: swapping preserves feasibility
hard
981Prove expected QuickSort comparisons is O(n log n)
hard
982Prove f(n)=O(g(n)) implies g(n)=Omega(f(n))
easy
983Prove Fibonacci upper bound using strong induction
medium
984Prove Floyd-Warshall optimal substructure
medium
985Prove greedy fractional knapsack optimal
medium
986Prove greedy min-max-lateness scheduling optimal via exchange
hard
987Prove greedy set cover achieves O(log n) approximation
hard
988Prove Hall's theorem
hard
989Prove HAMILTONIAN CYCLE NP-complete from 3SAT
hard
990Prove heap sort always O(n log n) regardless of input
easy
991Prove Huffman optimal via exchange argument on tree
hard
992Prove: if f is continuous, monotonic, and integer-valued only at integer arguments, then ⌊f(⌊x⌋)⌋ = ⌊f(x)⌋.
medium
993Prove Kruskal correctness via cut property
medium
994Prove Markov's inequality
medium
995Prove master theorem case 1: T(n)=aT(n/b)+cn^k, a>b^k => T(n)=Theta(n^{log_b a})
hard
996Prove master theorem case: T(n)=aT(n/b)+cn^k, a>b^k => T(n)=Theta(n^{log_b a})
hard
997Prove MAX-3SAT not approximable within 7/8 unless P=NP
hard
998Prove optimal solution reconstruction from DP table correct
medium
999Prove: P=NP implies every NP problem solves in polynomial time
medium
1000Prove randomly built BST has O(log n) expected height
hard
1001Prove reachable vertices from source computed in O(V+E)
easy
1002Prove RSelect runs in expected O(n) even with adversarial input
hard
1003Prove SAT phase transition at clause/variable ratio ~4.26
hard
1004Prove sum of first n integers formula by induction
easy
1005Prove sum of squares formula by induction
easy
1006Prove that (A-B) union (B-A) = (A union B) - (A intersect B)
medium
1007Prove that a tree with n vertices has n-1 edges
easy
1008Prove that for any non-constant integer polynomial f(x), |f(x)| is composite for infinitely many x.
medium
1009Prove that log n! = Theta(n log n)
medium
1010Prove that sqrt(2) is irrational
medium
1011Prove the Singleton bound: A(n, d) ≤ 2^(n−d+1).
medium
1012Prove undirected graph has <=2 components after removing one vertex
easy
1013Prove uniform hashing gives <=1/(1-alpha) expected unsuccessful probes
medium
1014Prove VERTEX COVER NP-complete from INDEPENDENT SET
medium
1015Prove weighted independent set DP has optimal substructure
medium
1016Pseudo-Palindromic Paths
medium
1017Pyramid Transition Matrix
medium
1018Pythagorean Triples
medium
1019Quadrant of a point
easy
1020Quadratic probing: show that (h(k)+c1i+c2i²) mod m covers all slots.
medium
1021Queries on Number of Points Inside a Circle
medium
1022Queue Using Two Stacks
medium
1023Quicksort with equal element values.
medium
1024Lane Marshal's Cursor Rover
hard
1025Radix trees: insert/search/delete strings in O(h) time.
medium
1026Weighted Traffic Shard Router
medium
1027Range Module
hard
1028Range Product Queries of Powers
medium
1029Range Sum Query 2D - Immutable
medium
1030Range Sum Query 2D Mutable
hard
1031Range Sum Query - Immutable
easy
1032Ransom Note
easy
1033Rational Bubble Sort
hard
1034Reachability in an undirected graph: O(V+E) algorithm using BFS/DFS.
medium
1035Multi-Call Chunked Stream Reader
hard
1036Request Trace Reconstruction
hard
1037Rectangle Area
medium
1038Rectangle Area II
hard
1039Rectangle Cutting
medium
1040Rectangle Overlap
easy
1041Recurrence examples: solve recurrences with the master method.
medium
1042Reduce 3SAT to INDEPENDENT SET via clause-variable gadget
hard
1043Reduce VERTEX COVER to DOMINATING SET
hard
1044Redundant Connection
medium
1045Reflect a point across a line
medium
1046Reflect a Point over a Line
medium
1047Relative asymptotic growths of common functions.
medium
1048Counting Removal Game
medium
1049Removal Game
easy
1050Clear the Binary Grid by Normalizing Row Patterns
medium
1051Remove Duplicates from Sorted Array
easy
1052Remove Duplicates from Sorted Array II
medium
1053Remove Duplicates from Sorted List II
medium
1054Remove Element
easy
1055Remove Invalid Parentheses
hard
1056Numeric Identifier Minimization
medium
1057Remove Nth Node From End of List
medium
1058Remove Sub-Folders from the Filesystem
medium
1059Reorder List
medium
1060Reorder Routes to Make All Paths Lead to the City Zero
medium
1061Repeated DNA Sequences
medium
1062Replace Words
medium
1063Represent directed graph with lists vs matrices - compare sparse/dense space
easy
1064Restore IP Addresses
medium
1065Reverse Bits
easy
1066Reverse the Numeric Token
medium
1067Reverse Letters in Place
easy
1068Reverse Linked List
easy
1069Reverse Linked List II
medium
1070Reverse Nodes in k-Group
hard
1071Reverse Pairs
hard
1072Reverse Pairs Count
medium
1073Reverse Vowels of a String
easy
1074Reverse Words in a String
medium
1075Right Triangles
medium
1076RightTriangle
medium
1077RLE Iterator
medium
1078Robot Room Cleaner
hard
1079Rod Cutting Profit
medium
1080Roman to Integer
easy
1081Rotate Array
medium
1082Rotate Image
medium
1083Rotate List
medium
1084Rotate List
medium
1085Rotten Oranges Spread
medium
1086Round an unsigned integer to the nearest multiple of 10, with (a) rounding up, (b) down, (c) to even multiple of 10.
medium
1087Round an unsigned integer to the nearest multiple of 8 with (a) rounding up, (b) down, (c) unbiased (make next bit zero).
medium
1088RSA attack: breaking RSA when d is small.
medium
1089Run Floyd-Warshall on 4 vertices, show distance matrices
easy
1090Run Kosaraju two-pass SCC on 8-vertex directed graph
hard
1091Run Kruskal on 7-vertex, 12-edge graph
easy
1092Russian Doll Envelopes
hard
1093Same Tree
easy
1094Satisfiability of Equality Equations
medium
1095Scheduling to minimize average completion time: prove greedy is optimal.
medium
1096Schroeppel's formula for base −2 to binary has a dual involving 0x5555555. Can you find it?
medium
1097Score After Flipping Matrix
medium
1098Search a 2D Matrix
medium
1099Search in Rotated Sorted Array
medium
1100Search Insert Position
easy
1101Search Suggestions System
medium
1102Searching a sorted compact list: use binary search on an array with gaps.
medium
1103Searching an unsorted array: analyze deterministic vs randomized search.
medium
1104Second-best minimum spanning tree: find MST of second-minimum total weight.
medium
1105Self Crossing
hard
1106Dashboard Layout: Sentence Screen Fitting
medium
1107Separate Black and White Balls
medium
1108Sequential Nim
medium
1109Serialize and Deserialize Binary Tree
hard
1110Set Matrix Zeroes
medium
1111Set Mismatch Finder
medium
1112Set packing: prove SET-PACKING is NP-complete.
medium
1113Shapes (ABC218 C)
easy
1114Sharygin 2012/8
medium
1115Shopping Offers
medium
1116Short Encoding of Words
medium
1117Shortest Bridge
medium
1118Shortest Distance to a Character
easy
1119Shortest Matching Substring
medium
1120Minimum Rollout Steps Across a Repairable Grid
hard
1121Shortest Path in Binary Matrix
medium
1122Shortest Path to Get All Keys
hard
1123Shortest Path Visiting All Nodes
hard
1124Shortest Path with Alternating Colors
medium
1125Shortest Subarray OR ≥ K
medium
1126Shortest Subarray OR ≥ K I
easy
1127Shortest Subarray OR ≥ K II
medium
1128Shortest Uncommon Substring in an Array
medium
1129Conveyor Repair Window
medium
1130Show all-pairs shortest path reduces to single-source case
medium
1131Show alternative decompositions of Boolean functions of three variables: (a) negative Davio, (b) z + h(x, y).
medium
1132Show bijection between natural and rational numbers
hard
1133Show chaining for keys [10,22,31,4,15,28] in table size 7
easy
1134Show CLIQUE NP-complete from 3SAT
medium
1135Show closest-pair works for Manhattan distance
medium
1136Show Cuckoo hashing insertion, prove expected O(1) amortized
hard
1137Show DSelect recurrence solves to O(n)
medium
1138Show greedy max cut achieves >= half optimal
medium
1139Show how all 16 binary Boolean operations can be done with eight instruction types from Table 2-3.
medium
1140Show how end-around carry can be used for addition in one's-complement. What is the max propagation length?
medium
1141Show how to add 1 to a base −2 number using arithmetic and logical operations.
medium
1142Show how to avoid shrxi for unsigned division by an even number using two methods.
medium
1143Show how to implement x ⊕ y in four instructions with and-or-not logic.
medium
1144Show how to round a base −2 number down to a multiple of 16.
medium
1145Show inorder traversal sequence of a BST
easy
1146Show log(n!) = Theta(n log n) via Stirling
hard
1147Show NP != co-NP implies P != NP
medium
1148Show polynomial SAT solver implies P=NP
hard
1149Show prefix-free condition equivalent to full binary tree
medium
1150Show Prim with heap runs in O((E+V) log V)
hard
1151Show QuickSort recursion depth O(log n) with high probability
medium
1152Show reversing all DAG edges reverses topological order
medium
1153Show SAT in O(1.5^n) via DPLL with unit propagation
medium
1154Show that if a generator G has ≥2 terms, all single-bit errors are detected.
medium
1155Show that if d > 2n/3, then A(n, d) = 2.
medium
1156Show that if two numbers are added with end-around carry, the addition of the carry bit cannot generate another carry out of the high-order position.
medium
1157Show that not all Boolean functions of three variables can be implemented with three binary logical instructions.
medium
1158Show that six instruction types suffice for R-I (register-immediate) Boolean operations.
medium
1159Show that the low-order 32 bits of a 32×32→64 multiplication are the same for signed and unsigned operands.
medium
1160Show that (x & m) | (y & ~m) can be done in three instructions on the basic RISC.
medium
1161Show VCG mechanism applied to spectrum allocation
hard
1162Significance of Exponential Time Hypothesis for algorithm design
medium
1163Similar String Groups
hard
1164Similarly, how many n-bit words have shortest contained string of 1's of length 2?
medium
1165Simplify Path
medium
1166Simplify the maxOR function (Figure 4-4) when a = 0 or c = 0, on a machine with nlz instruction.
medium
1167Simplify the seven-instruction expression for x ≤ y to three basic RISC instructions if y31 = 0.
medium
1168Find Unique Element
easy
1169Unique Element Among Triples
medium
1170Two Unique Elements
medium
1171Sliding Puzzle
hard
1172Sliding Window Maximum
medium
1173Slot-size bound for chaining: expected number of keys in a slot.
medium
1174Small order statistics: find the kth smallest for small k in O(n) time.
medium
1175Smallest Divisible Digit Product II
hard
1176Smallest Number With All Set Bits
easy
1177Smallest String Starting From Leaf
medium
1178Smallest Subarray Max OR
medium
1179Smallest Sufficient Team
hard
1180Snakes and Ladders
medium
1181Versioned Array Snapshots
medium
1182Solve 0/1 knapsack capacity 10 with given items
easy
1183Solve Fibonacci recurrence
medium
1184Solve recurrence using generating functions
hard
1185Solve subset-sum: find subset summing to target
easy
1186Solve T(n)=2T(n/2)+n/log n - can master theorem apply?
hard
1187Solve T(n)=2T(n/2)+n log n via master method
easy
1188Solve T(n)=3T(n/4)+n log n - which case?
medium
1189Solve T(n)=9T(n/3)+n via master method
easy
1190Solve T(n)=T(2n/3)+1 - which algorithm?
easy
1191Solve task scheduling with deadlines/profits using greedy
medium
1192Solve unbounded knapsack (unlimited reuse) via DP
medium
1193Solving Questions With Brainpower
medium
1194Sort Array by Moving Items to an Empty Cache Slot
hard
1195Sort Colors (Dutch Flag)
medium
1196Sort by Number of Set Bits
easy
1197Sort Integers by the Power Value
medium
1198Sort Items by Groups Respecting Dependencies
hard
1199Sort List
medium
1200Sort Stack Recursively
medium
1201Sort the People
easy
1202Sort Words by Length
easy
1203Sorting in place in linear time: counting sort with O(1) extra space.
medium
1204Sorting variable-length items: sort strings of different lengths in O(n) time.
medium
1205Soup Servings
medium
1206Special Permutations
medium
1207Spiral Matrix
medium
1208Split a String Into the Max Number of Unique Substrings
medium
1209Split Array into Fibonacci Sequence
medium
1210Distributed Batch Scheduling to Minimize Peak Load
hard
1211Split Array Same Average
hard
1212Splitting a String Into Descending Consecutive Values
medium
1213Sqrt(x)
easy
1214Stable matching with ties and incomplete lists: Gale-Shapley variant.
medium
1215Stack depth for quicksort: tail recursion optimization.
medium
1216Stack Using Single Queue
medium
1217Staircase Nim
medium
1218Star Map
medium
1219Stars
easy
1220Step-by-Step Directions from One Binary Tree Node to Another
medium
1221Stepping Numbers
medium
1222Stick Removal Game
easy
1223Stickers to Spell Word
hard
1224Telemetry Price Tracker
medium
1225Stock Span Problem
medium
1226Stone Division
hard
1227Stone Division II
hard
1228Stone Game
medium
1229Stone Game II
medium
1230Stone Game III
hard
1231Stone Game IV
hard
1232Stone Game IX
medium
1233Stone Game V
hard
1234Stone Game VI
medium
1235Stone Game VII
medium
1236Stone Game VIII
hard
1237Stone Removal Duel
easy
1238Stooge sort: analyze this inefficient sorting algorithm.
medium
1239Stream of Characters
hard
1240String matching based on repetition factors: O(n) algorithm using border analysis.
medium
1241The One-Flip Label Audit
medium
1242Strobogrammatic Number
easy
1243Strongly Connected Components
hard
1244Student Attendance Record II
hard
1245Subarray Product Constraint
medium
1246Subarray Sum Equals K
medium
1247Subarrays with K Distinct
hard
1248Subarrays with XOR at Least K
hard
1249Subgraph isomorphism: prove SUBGRAPH-ISOMORPHISM is NP-complete.
medium
1250Subsequence Match Builder
medium
1251Subsequence With XOR Value K
medium
1252Generate All Subsets
medium
1253Subsets With Duplicates
medium
1254Substring Removal Game
easy
1255Substring with Concatenation of All Words
hard
1256Subtraction Game
easy
1257Subtree of Another Tree
easy
1258Subtree Removal Game
hard
1259Sudoku Solver
hard
1260Suffix arrays: construct SA in O(n) and use for pattern matching.
medium
1261Sum Game
medium
1262Sum of Odd Length Subarrays
easy
1263Sum of All Subset XOR Totals
easy
1264Sum of Prefix Scores of Strings
hard
1265Sum of Subarray Minimums
medium
1266Total Latency Spread Across All Monitoring Windows
medium
1267Sum of Two Integers
medium
1268Sum at Set Bit Indices
easy
1269Sum Root to Leaf Numbers
medium
1270Summary Ranges
easy
1271Super Egg Drop Problem
hard
1272Surrounded Regions
medium
1273Single Lane Fleet Migration
medium
1274Phased Infrastructure Activation
hard
1275Symmetric Tree
easy
1276Synonymous Sentences
medium
1277Take-Away Game
easy
1278Tallest Billboard
hard
1279Target Sum
medium
1280Tarjan's off-line least-common-ancestors algorithm.
medium
1281Tell me about a time you failed
easy
1282Tell me about a time you led a team
easy
1283Tell Your World
medium
1284Text Justification
hard
1285The Closest Distance
medium
1286The function x << (x & 1) is a left shift by a variable amount but is right-to-left computable. What is going on? Find another such function.
medium
1287The instructions of the basic and full RISCs can be executed with at most two register reads and one write. Show this.
medium
1288The k-th Lexicographical String of All Happy Strings of Length n
medium
1289The Knight's Tour
medium
1290The Lazy Student
medium
1291The Number of Beautiful Subsets
medium
1292The Number of Good Subsets
hard
1293Three Character Substring Count
easy
1294Three Sum Zero
medium
1295Tiling a Rectangle with the Fewest Squares
hard
1296Time Needed to Inform All Employees
medium
1297Toeplitz matrices: multiply a Toeplitz matrix by a vector using FFT.
medium
1298Top K Frequent Elements
medium
1299Top K Frequent Words
medium
1300Topological Sort DFS
medium
1301Total Hamming Distance
medium
1302Tower Breakers
easy
1303Tower Breakers Strike Back
medium
1304Trace Bellman-Ford on 5-vertex graph with negative edge
easy
1305Trace BFS on 7-vertex graph, find shortest paths from s
easy
1306Trace Dijkstra on weighted 6-vertex graph from A
easy
1307Trace Prim on weighted 6-vertex graph from A
easy
1308Trace QuickSort on [4,1,3,5,2] with last-element pivot
easy
1309Trace RSelect finding 3rd smallest in [7,2,9,4,3,8,5]
easy
1310Transform to Chessboard
hard
1311Transitive closure of a dynamic graph: maintain transitive closure under edge insertions.
medium
1312Trapping Rain Water
hard
1313Treaps: randomized search trees with BST and heap properties.
medium
1314Tree Tag
medium
1315Triangle
medium
1316Triangles on a Rectangle
easy
1317Triangular systems of equations: parallel algorithm for back-substitution.
medium
1318AND of Triples Zero
hard
1319Two Out of Three
easy
1320Two Sum
easy
1321Two Sum II - Input Array Is Sorted
medium
1322Two Sum Pair Finder
medium
1323Type of Triangle
easy
1324Uncrossed Lines
medium
1325Union and Intersection of Two Sorted Arrays
medium
1326Unique Binary Search Trees
medium
1327Unique Binary Search Trees II
medium
1328Mailroom Router
easy
1329Unique Length-3 Palindromic Subsequences
medium
1330Unique Paths
medium
1331Unique Paths II
medium
1332Unique Paths III
hard
1333Use inclusion-exclusion to count set covers in O(2^m poly(n))
hard
1334UTF-8 Validation
medium
1335Valid Anagram
easy
1336Valid Boomerang
easy
1337Valid Palindrome
easy
1338Valid Parentheses
easy
1339Valid Parentheses Checker
medium
1340Valid Square
medium
1341Valid Sudoku
medium
1342Tic-Tac-Toe Check
medium
1343Valid Triangle Number
medium
1344Validate Binary Search Tree
medium
1345Staged Release Pipeline
medium
1346Vanya and Triangles
hard
1347VC dimension of axis-aligned rectangles: compute VC dimension.
medium
1348Verbal Arithmetic Puzzle
hard
1349Vertex cover: prove VERTEX-COVER is NP-complete.
medium
1350Vlad and Shapes
easy
1351Vowels String Game
medium
1352Weak Characters in the Game
medium
1353What is A(n, d) if n = d? Show that for odd n these codes are perfect.
medium
1354What numbers have the same representation (apart from trailing 0's) in both single- and double-precision?
medium
1355Where Do I Turn?
medium
1356Why does Dijkstra fail with negative edges?
medium
1357Why truthfulness matters in auction design
medium
1358Why TSP believed harder than MST: decision vs optimization?
easy
1359Wiggle Subsequence
medium
1360Matchstick Winner
easy
1361Word Abbreviation
hard
1362Word Break
medium
1363Word Break II
hard
1364Word Ladder
hard
1365Word Ladder II
hard
1366Word Pattern
easy
1367Word Pattern II
medium
1368Word Search
medium
1369Word Search II
hard
1370Word Squares
hard
1371Word Squares II
medium
1372Wording Duel
hard
1373Words Within Two Edits of Dictionary
medium
1374World of Darkraft
hard
1375Write a program to convert a base −1+i integer to the form a + bi.
medium
1376Wythoff's Game
hard
1377XOR in Array
easy
1378XOR Queries of Subarray
medium
1379Young tableau: an m×n matrix with sorted rows and columns.
medium
1380Zero Array Transformation II
medium
1381Zero Filled Subarrays Count
medium
1382Zigzag Conversion
medium
1383ZOAC
hard
© 2026 FrontendX. All rights reserved.