Skip to content
We areTOP 1%
DSA · 9 patterns · 120 questions

Pro DSA

For students who are comfortable with the core patterns and are preparing for product-company interviews and harder online assessments. Covers 2-D DP, weighted graphs, disjoint sets, tries, sweep lines, bit manipulation, advanced tree techniques and data-structure design.
Pro progress0%
1st Visit
0/120
2nd Visit
0/120
Revise
0/120

2-D Dynamic Programming

0/20

Two dimensional DP stores the answer to a subproblem indexed by two parameters: most often a pair of prefixes of two strings, a cell of a grid, or a position combined…

Pattern guide
2-D Dynamic Programming questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Unique Paths IILeetCodeMedium Solve Unique Paths II on LeetCode (opens in a new tab)
2Minimum Path SumLeetCodeMedium Solve Minimum Path Sum on LeetCode (opens in a new tab)
3TriangleLeetCodeMedium Solve Triangle on LeetCode (opens in a new tab)
4Basketball ExerciseCodeforcesMedium 1400Solve Basketball Exercise on Codeforces (opens in a new tab)
5Longest Common SubsequenceLeetCodeMedium Solve Longest Common Subsequence on LeetCode (opens in a new tab)
6Maximal SquareLeetCodeMedium Solve Maximal Square on LeetCode (opens in a new tab)
7Three StringsCodeforcesMedium 1500Solve Three Strings on Codeforces (opens in a new tab)
8Coin Change IILeetCodeMedium Solve Coin Change II on LeetCode (opens in a new tab)
9Longest Palindromic SubsequenceLeetCodeMedium Solve Longest Palindromic Subsequence on LeetCode (opens in a new tab)
10Edit DistanceLeetCodeMedium Solve Edit Distance on LeetCode (opens in a new tab)
11k-TreeCodeforcesMedium 1600Solve k-Tree on Codeforces (opens in a new tab)
12Hard problemCodeforcesMedium 1600Solve Hard problem on Codeforces (opens in a new tab)
13Make Them EqualCodeforcesMedium 1600Solve Make Them Equal on Codeforces (opens in a new tab)
14Zero PathCodeforcesMedium 1700Solve Zero Path on Codeforces (opens in a new tab)
15Caesar's LegionsCodeforcesMedium 1700Solve Caesar's Legions on Codeforces (opens in a new tab)
16Sleeping ScheduleCodeforcesMedium 1700Solve Sleeping Schedule on Codeforces (opens in a new tab)
17George and JobCodeforcesMedium 1700Solve George and Job on Codeforces (opens in a new tab)
18Distinct SubsequencesLeetCodeHard Solve Distinct Subsequences on LeetCode (opens in a new tab)
19Wildcard MatchingLeetCodeHard Solve Wildcard Matching on LeetCode (opens in a new tab)
20Cherry Pickup IILeetCodeHard Solve Cherry Pickup II on LeetCode (opens in a new tab)

Shortest Paths & Topological Sort

0/15

Weighted graphs need more than plain BFS. Dijkstra's algorithm finds single source shortest paths when every weight is non negative, using a min heap in O((V + E) log…

Pattern guide
Shortest Paths & Topological Sort questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Course Schedule IILeetCodeMedium Solve Course Schedule II on LeetCode (opens in a new tab)
2Find Eventual Safe StatesLeetCodeMedium Solve Find Eventual Safe States on LeetCode (opens in a new tab)
3Network Delay TimeLeetCodeMedium Solve Network Delay Time on LeetCode (opens in a new tab)
4Path With Minimum EffortLeetCodeMedium Solve Path With Minimum Effort on LeetCode (opens in a new tab)
5Cheapest Flights Within K StopsLeetCodeMedium Solve Cheapest Flights Within K Stops on LeetCode (opens in a new tab)
6Find the City With the Smallest Number of Neighbors at a Threshold DistanceLeetCodeMedium Solve Find the City With the Smallest Number of Neighbors at a Threshold Distance on LeetCode (opens in a new tab)
7Number of Ways to Arrive at DestinationLeetCodeMedium Solve Number of Ways to Arrive at Destination on LeetCode (opens in a new tab)
8Fox And NamesCodeforcesMedium 1600Solve Fox And Names on Codeforces (opens in a new tab)
9The Two RoutesCodeforcesMedium 1600Solve The Two Routes on Codeforces (opens in a new tab)
10Greg and GraphCodeforcesMedium 1700Solve Greg and Graph on Codeforces (opens in a new tab)
11SubstringCodeforcesMedium 1700Solve Substring on Codeforces (opens in a new tab)
12LabyrinthCodeforcesHard 1800Solve Labyrinth on Codeforces (opens in a new tab)
13BicyclesCodeforcesHard 1800Solve Bicycles on Codeforces (opens in a new tab)
14Parallel Courses IIILeetCodeHard Solve Parallel Courses III on LeetCode (opens in a new tab)
15Dijkstra?CodeforcesHard 1900Solve Dijkstra? on Codeforces (opens in a new tab)

Union-Find (DSU)

0/12

A disjoint set union (DSU) maintains a partition of elements into groups and supports two operations: find, which returns the representative of an element's group, and…

Pattern guide
Union-Find (DSU) questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Redundant ConnectionLeetCodeMedium Solve Redundant Connection on LeetCode (opens in a new tab)
2Satisfiability of Equality EquationsLeetCodeMedium Solve Satisfiability of Equality Equations on LeetCode (opens in a new tab)
3Number of Operations to Make Network ConnectedLeetCodeMedium Solve Number of Operations to Make Network Connected on LeetCode (opens in a new tab)
4News DistributionCodeforcesMedium 1400Solve News Distribution on Codeforces (opens in a new tab)
5Accounts MergeLeetCodeMedium Solve Accounts Merge on LeetCode (opens in a new tab)
6Most Stones Removed with Same Row or ColumnLeetCodeMedium Solve Most Stones Removed with Same Row or Column on LeetCode (opens in a new tab)
7Bear and Friendship ConditionCodeforcesMedium 1500Solve Bear and Friendship Condition on Codeforces (opens in a new tab)
8SocksCodeforcesMedium 1600Solve Socks on Codeforces (opens in a new tab)
9Destroying ArrayCodeforcesMedium 1600Solve Destroying Array on Codeforces (opens in a new tab)
10Path QueriesCodeforcesHard 1800Solve Path Queries on Codeforces (opens in a new tab)
11Making A Large IslandLeetCodeHard Solve Making A Large Island on LeetCode (opens in a new tab)
12Remove Max Number of Edges to Keep Graph Fully TraversableLeetCodeHard Solve Remove Max Number of Edges to Keep Graph Fully Traversable on LeetCode (opens in a new tab)

Trie

0/10

A trie stores strings character by character along paths from a shared root, so all words with a common prefix share the same nodes. Insertion and lookup take O(L) for…

Pattern guide
Trie questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Implement Trie (Prefix Tree)LeetCodeMedium Solve Implement Trie (Prefix Tree) on LeetCode (opens in a new tab)
2Longest Word in DictionaryLeetCodeMedium Solve Longest Word in Dictionary on LeetCode (opens in a new tab)
3Design Add and Search Words Data StructureLeetCodeMedium Solve Design Add and Search Words Data Structure on LeetCode (opens in a new tab)
4Maximum XOR of Two Numbers in an ArrayLeetCodeMedium Solve Maximum XOR of Two Numbers in an Array on LeetCode (opens in a new tab)
5Polycarp's phone bookCodeforcesMedium 1600Solve Polycarp's phone book on Codeforces (opens in a new tab)
6Good SubstringsCodeforcesHard 1800Solve Good Substrings on Codeforces (opens in a new tab)
7Vasiliy's MultisetCodeforcesHard 1800Solve Vasiliy's Multiset on Codeforces (opens in a new tab)
8Perfect SecurityCodeforcesHard 1800Solve Perfect Security on Codeforces (opens in a new tab)
9Maximum XOR With an Element From ArrayLeetCodeHard Solve Maximum XOR With an Element From Array on LeetCode (opens in a new tab)
10Word Search IILeetCodeHard Solve Word Search II on LeetCode (opens in a new tab)

Intervals & Sweep Line

0/12

Interval problems describe ranges such as meetings, bookings, segments or trips. Sorting by start, or by end for greedy selection, brings overlapping ranges next to…

Pattern guide
Intervals & Sweep Line questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Merge IntervalsLeetCodeMedium Solve Merge Intervals on LeetCode (opens in a new tab)
2Insert IntervalLeetCodeMedium Solve Insert Interval on LeetCode (opens in a new tab)
3Non-overlapping IntervalsLeetCodeMedium Solve Non-overlapping Intervals on LeetCode (opens in a new tab)
4Interval List IntersectionsLeetCodeMedium Solve Interval List Intersections on LeetCode (opens in a new tab)
5Car PoolingLeetCodeMedium Solve Car Pooling on LeetCode (opens in a new tab)
6Divide Intervals Into Minimum Number of GroupsLeetCodeMedium Solve Divide Intervals Into Minimum Number of Groups on LeetCode (opens in a new tab)
7Little Girl and Maximum SumCodeforcesMedium 1500Solve Little Girl and Maximum Sum on Codeforces (opens in a new tab)
8Maximal IntersectionCodeforcesMedium 1600Solve Maximal Intersection on Codeforces (opens in a new tab)
9Covered Points CountCodeforcesMedium 1700Solve Covered Points Count on Codeforces (opens in a new tab)
10Painting the FenceCodeforcesMedium 1700Solve Painting the Fence on Codeforces (opens in a new tab)
11The Treasure of The SegmentsCodeforcesHard 1800Solve The Treasure of The Segments on Codeforces (opens in a new tab)
12Minimum Interval to Include Each QueryLeetCodeHard Solve Minimum Interval to Include Each Query on LeetCode (opens in a new tab)

Bit Manipulation

0/12

Bit manipulation treats an integer as a vector of independent bits. The core tools are x & (x 1) to clear the lowest set bit, x & x to isolate it, XOR to cancel equal…

Pattern guide
Bit Manipulation questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Single Number IILeetCodeMedium Solve Single Number II on LeetCode (opens in a new tab)
2Single Number IIILeetCodeMedium Solve Single Number III on LeetCode (opens in a new tab)
3Bitwise AND of Numbers RangeLeetCodeMedium Solve Bitwise AND of Numbers Range on LeetCode (opens in a new tab)
4Total Hamming DistanceLeetCodeMedium Solve Total Hamming Distance on LeetCode (opens in a new tab)
5Find the Longest Substring Containing Vowels in Even CountsLeetCodeMedium Solve Find the Longest Substring Containing Vowels in Even Counts on LeetCode (opens in a new tab)
6AGAGA XOOORRRCodeforcesMedium 1500Solve AGAGA XOOORRR on Codeforces (opens in a new tab)
7Data Structures FanCodeforcesMedium 1500Solve Data Structures Fan on Codeforces (opens in a new tab)
8Boboniu and Bit OperationsCodeforcesMedium 1600Solve Boboniu and Bit Operations on Codeforces (opens in a new tab)
9Bitwise ORs of SubarraysLeetCodeMedium Solve Bitwise ORs of Subarrays on LeetCode (opens in a new tab)
10AND, OR and square sumCodeforcesMedium 1700Solve AND, OR and square sum on Codeforces (opens in a new tab)
11Little Girl and Maximum XORCodeforcesMedium 1700Solve Little Girl and Maximum XOR on Codeforces (opens in a new tab)
12BitsCodeforcesMedium 1700Solve Bits on Codeforces (opens in a new tab)

Advanced Trees (BST, LCA, Tree DP)

0/16

Tree problems at this level rely on three ideas beyond basic traversal. In a binary search tree, in order traversal visits keys in sorted order, which makes validation…

Pattern guide
Advanced Trees (BST, LCA, Tree DP) questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Lowest Common Ancestor of a Binary Search TreeLeetCodeMedium Solve Lowest Common Ancestor of a Binary Search Tree on LeetCode (opens in a new tab)
2Delete Node in a BSTLeetCodeMedium Solve Delete Node in a BST on LeetCode (opens in a new tab)
3Construct Binary Search Tree from Preorder TraversalLeetCodeMedium Solve Construct Binary Search Tree from Preorder Traversal on LeetCode (opens in a new tab)
4Binary Search Tree IteratorLeetCodeMedium Solve Binary Search Tree Iterator on LeetCode (opens in a new tab)
5Recover Binary Search TreeLeetCodeMedium Solve Recover Binary Search Tree on LeetCode (opens in a new tab)
6House Robber IIILeetCodeMedium Solve House Robber III on LeetCode (opens in a new tab)
7Military ProblemCodeforcesMedium 1600Solve Military Problem on Codeforces (opens in a new tab)
8Infected TreeCodeforcesMedium 1600Solve Infected Tree on Codeforces (opens in a new tab)
9Parsa's Humongous TreeCodeforcesMedium 1600Solve Parsa's Humongous Tree on Codeforces (opens in a new tab)
10Choosing Capital for TreelandCodeforcesMedium 1700Solve Choosing Capital for Treeland on Codeforces (opens in a new tab)
11Distance in TreeCodeforcesHard 1800Solve Distance in Tree on Codeforces (opens in a new tab)
12Maximum White SubtreeCodeforcesHard 1800Solve Maximum White Subtree on Codeforces (opens in a new tab)
13Kth Ancestor of a Tree NodeLeetCodeHard Solve Kth Ancestor of a Tree Node on LeetCode (opens in a new tab)
14Maximum Sum BST in Binary TreeLeetCodeHard Solve Maximum Sum BST in Binary Tree on LeetCode (opens in a new tab)
15Fools and RoadsCodeforcesHard 1900Solve Fools and Roads on Codeforces (opens in a new tab)
16Sum of Distances in TreeLeetCodeHard Solve Sum of Distances in Tree on LeetCode (opens in a new tab)

Design Data Structures

0/10

Design problems ask you to implement a class whose operations must each meet a time bound, typically O(1) or O(log n). The work lies in choosing and combining…

Pattern guide
Design Data Structures questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Insert Delete GetRandom O(1)LeetCodeMedium Solve Insert Delete GetRandom O(1) on LeetCode (opens in a new tab)
2LRU CacheLeetCodeMedium Solve LRU Cache on LeetCode (opens in a new tab)
3Design TwitterLeetCodeMedium Solve Design Twitter on LeetCode (opens in a new tab)
4Snapshot ArrayLeetCodeMedium Solve Snapshot Array on LeetCode (opens in a new tab)
5Glass CarvingCodeforcesMedium 1500Solve Glass Carving on Codeforces (opens in a new tab)
6Lunar New Year and Food OrderingCodeforcesMedium 1500Solve Lunar New Year and Food Ordering on Codeforces (opens in a new tab)
7Constructing the ArrayCodeforcesMedium 1600Solve Constructing the Array on Codeforces (opens in a new tab)
8Two TeamsCodeforcesHard 1800Solve Two Teams on Codeforces (opens in a new tab)
9Maximum Frequency StackLeetCodeHard Solve Maximum Frequency Stack on LeetCode (opens in a new tab)
10LFU CacheLeetCodeHard Solve LFU Cache on LeetCode (opens in a new tab)

Mixed Practice

All patterns0/13

This set draws on every pattern in the Pro level, but the pattern label is deliberately hidden. In interviews and contests nobody tells you which technique applies, so…

Pattern guide
Mixed Practice questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1BerpizzaCodeforcesMedium 1400Solve Berpizza on Codeforces (opens in a new tab)
2Search Suggestions SystemLeetCodeMedium Solve Search Suggestions System on LeetCode (opens in a new tab)
3Interleaving StringLeetCodeMedium Solve Interleaving String on LeetCode (opens in a new tab)
4Knight TournamentCodeforcesMedium 1500Solve Knight Tournament on Codeforces (opens in a new tab)
5Linova and KingdomCodeforcesMedium 1600Solve Linova and Kingdom on Codeforces (opens in a new tab)
6Ehab the XorcistCodeforcesMedium 1700Solve Ehab the Xorcist on Codeforces (opens in a new tab)
7Andrey and Escape from CapygradCodeforcesHard 1800Solve Andrey and Escape from Capygrad on Codeforces (opens in a new tab)
8Swim in Rising WaterLeetCodeHard Solve Swim in Rising Water on LeetCode (opens in a new tab)
9Longest Increasing Path in a MatrixLeetCodeHard Solve Longest Increasing Path in a Matrix on LeetCode (opens in a new tab)
10Maximum Profit in Job SchedulingLeetCodeHard Solve Maximum Profit in Job Scheduling on LeetCode (opens in a new tab)
11Binary Tree CamerasLeetCodeHard Solve Binary Tree Cameras on LeetCode (opens in a new tab)
12Number of Good PathsLeetCodeHard Solve Number of Good Paths on LeetCode (opens in a new tab)
13Tree with Maximum CostCodeforcesHard 1900Solve Tree with Maximum Cost on Codeforces (opens in a new tab)

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account