Skip to content
We areTOP 1%
DSA · 11 patterns · 140 questions

Beginner DSA

For students starting structured DSA practice. Covers arrays and hashing, two pointers, strings, matrices, prefix sums, binary search, recursion, linked lists, stacks and queues, and math and implementation, with Codeforces problems rated 800–1200.
Beginner progress0%
1st Visit
0/140
2nd Visit
0/140
Revise
0/140

Arrays & Hashing

0/15

Arrays store elements contiguously, giving O(1) access by index; hash maps and hash sets add O(1) average time lookup by value. Together they turn many brute force…

Pattern guide
Arrays & Hashing questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Contains DuplicateLeetCodeEasy Solve Contains Duplicate on LeetCode (opens in a new tab)
2Two SumLeetCodeEasy Solve Two Sum on LeetCode (opens in a new tab)
3ICPC BalloonsCodeforcesEasy 800Solve ICPC Balloons on Codeforces (opens in a new tab)
4Word GameCodeforcesEasy 800Solve Word Game on Codeforces (opens in a new tab)
5All DistinctCodeforcesEasy 800Solve All Distinct on Codeforces (opens in a new tab)
6Remove DuplicatesCodeforcesEasy 800Solve Remove Duplicates on Codeforces (opens in a new tab)
7Majority ElementLeetCodeEasy Solve Majority Element on LeetCode (opens in a new tab)
8Set MismatchLeetCodeEasy Solve Set Mismatch on LeetCode (opens in a new tab)
9FootballCodeforcesEasy 1000Solve Football on Codeforces (opens in a new tab)
10Two Teams ComposingCodeforcesEasy 1100Solve Two Teams Composing on Codeforces (opens in a new tab)
11A and B and Compilation ErrorsCodeforcesEasy 1100Solve A and B and Compilation Errors on Codeforces (opens in a new tab)
12Same DifferencesCodeforcesEasy 1200Solve Same Differences on Codeforces (opens in a new tab)
13Group AnagramsLeetCodeMedium Solve Group Anagrams on LeetCode (opens in a new tab)
14Majority Element IILeetCodeMedium Solve Majority Element II on LeetCode (opens in a new tab)
15Longest Consecutive SequenceLeetCodeMedium Solve Longest Consecutive Sequence on LeetCode (opens in a new tab)

Two Pointers

0/12

Two pointers keeps two indices that move through a sequence according to a rule, so that every step discards candidates that cannot be optimal. The common forms are…

Pattern guide
Two Pointers questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Valid PalindromeLeetCodeEasy Solve Valid Palindrome on LeetCode (opens in a new tab)
2Remove Duplicates from Sorted ArrayLeetCodeEasy Solve Remove Duplicates from Sorted Array on LeetCode (opens in a new tab)
3Merge Sorted ArrayLeetCodeEasy Solve Merge Sorted Array on LeetCode (opens in a new tab)
4Sereja and DimaCodeforcesEasy 800Solve Sereja and Dima on Codeforces (opens in a new tab)
5Prepend and AppendCodeforcesEasy 800Solve Prepend and Append on Codeforces (opens in a new tab)
6Eating CandiesCodeforcesEasy 1100Solve Eating Candies on Codeforces (opens in a new tab)
7Kalindrome ArrayCodeforcesEasy 1100Solve Kalindrome Array on Codeforces (opens in a new tab)
8Alice, Bob and ChocolateCodeforcesEasy 1200Solve Alice, Bob and Chocolate on Codeforces (opens in a new tab)
9Two Sum II - Input Array Is SortedLeetCodeMedium Solve Two Sum II - Input Array Is Sorted on LeetCode (opens in a new tab)
10Sort ColorsLeetCodeMedium Solve Sort Colors on LeetCode (opens in a new tab)
11Container With Most WaterLeetCodeMedium Solve Container With Most Water on LeetCode (opens in a new tab)
123SumLeetCodeMedium Solve 3Sum on LeetCode (opens in a new tab)

Strings

0/13

String problems are array problems over characters, with a few recurring tools: frequency tables of size 26 or 256, comparing characters from both ends, building output…

Pattern guide
Strings questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Way Too Long WordsCodeforcesEasy 800Solve Way Too Long Words on Codeforces (opens in a new tab)
2Petya and StringsCodeforcesEasy 800Solve Petya and Strings on Codeforces (opens in a new tab)
3Boy or GirlCodeforcesEasy 800Solve Boy or Girl on Codeforces (opens in a new tab)
4PangramCodeforcesEasy 800Solve Pangram on Codeforces (opens in a new tab)
5Valid AnagramLeetCodeEasy Solve Valid Anagram on LeetCode (opens in a new tab)
6Roman to IntegerLeetCodeEasy Solve Roman to Integer on LeetCode (opens in a new tab)
7Isomorphic StringsLeetCodeEasy Solve Isomorphic Strings on LeetCode (opens in a new tab)
8Longest Common PrefixLeetCodeEasy Solve Longest Common Prefix on LeetCode (opens in a new tab)
9DubstepCodeforcesEasy 900Solve Dubstep on Codeforces (opens in a new tab)
10String TaskCodeforcesEasy 1000Solve String Task on Codeforces (opens in a new tab)
11Chat roomCodeforcesEasy 1000Solve Chat room on Codeforces (opens in a new tab)
12Reverse Words in a StringLeetCodeMedium Solve Reverse Words in a String on LeetCode (opens in a new tab)
13Longest Palindromic SubstringLeetCodeMedium Solve Longest Palindromic Substring on LeetCode (opens in a new tab)

Matrix (2-D Arrays)

0/10

A matrix is a 2 D array indexed by row and column; visiting all m n cells costs O(m n). Most problems combine a few moves: scanning rows or columns, walking the…

Pattern guide
Matrix (2-D Arrays) questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Matrix Diagonal SumLeetCodeEasy Solve Matrix Diagonal Sum on LeetCode (opens in a new tab)
2Beautiful MatrixCodeforcesEasy 800Solve Beautiful Matrix on Codeforces (opens in a new tab)
3Transpose MatrixLeetCodeEasy Solve Transpose Matrix on LeetCode (opens in a new tab)
4Target PracticeCodeforcesEasy 800Solve Target Practice on Codeforces (opens in a new tab)
5Pascal's TriangleLeetCodeEasy Solve Pascal's Triangle on LeetCode (opens in a new tab)
6Lights OutCodeforcesEasy 900Solve Lights Out on Codeforces (opens in a new tab)
7Set Matrix ZeroesLeetCodeMedium Solve Set Matrix Zeroes on LeetCode (opens in a new tab)
8Valid SudokuLeetCodeMedium Solve Valid Sudoku on LeetCode (opens in a new tab)
9Rotate ImageLeetCodeMedium Solve Rotate Image on LeetCode (opens in a new tab)
10Spiral MatrixLeetCodeMedium Solve Spiral Matrix on LeetCode (opens in a new tab)

Prefix Sum

0/11

A prefix sum array stores pre[i], the total of the first i elements, so any subarray sum a[l..r] equals pre[r + 1] pre[l] in O(1) after O(n) preprocessing. The same…

Pattern guide
Prefix Sum questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Running Sum of 1d ArrayLeetCodeEasy Solve Running Sum of 1d Array on LeetCode (opens in a new tab)
2Find Pivot IndexLeetCodeEasy Solve Find Pivot Index on LeetCode (opens in a new tab)
3Range Sum Query - ImmutableLeetCodeEasy Solve Range Sum Query - Immutable on LeetCode (opens in a new tab)
4Odd QueriesCodeforcesEasy 900Solve Odd Queries on Codeforces (opens in a new tab)
5Distinct SplitCodeforcesEasy 1000Solve Distinct Split on Codeforces (opens in a new tab)
6Ilya and QueriesCodeforcesEasy 1100Solve Ilya and Queries on Codeforces (opens in a new tab)
7Sereja and SuffixesCodeforcesEasy 1100Solve Sereja and Suffixes on Codeforces (opens in a new tab)
8Kuriyama Mirai's StonesCodeforcesEasy 1200Solve Kuriyama Mirai's Stones on Codeforces (opens in a new tab)
9Range Sum Query 2D - ImmutableLeetCodeMedium Solve Range Sum Query 2D - Immutable on LeetCode (opens in a new tab)
10Product of Array Except SelfLeetCodeMedium Solve Product of Array Except Self on LeetCode (opens in a new tab)
11Subarray Sum Equals KLeetCodeMedium Solve Subarray Sum Equals K on LeetCode (opens in a new tab)

Recursion

0/11

A recursive function solves a problem by calling itself on smaller instances until it reaches a base case that is answered directly. Writing one comes down to three…

Pattern guide
Recursion questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Fibonacci NumberLeetCodeEasy Solve Fibonacci Number on LeetCode (opens in a new tab)
2Sum in Binary TreeCodeforcesEasy 800Solve Sum in Binary Tree on Codeforces (opens in a new tab)
3Lucky DivisionCodeforcesEasy 1000Solve Lucky Division on Codeforces (opens in a new tab)
4Little Elephant and FunctionCodeforcesEasy 1000Solve Little Elephant and Function on Codeforces (opens in a new tab)
5Tavas and SaDDasCodeforcesEasy 1100Solve Tavas and SaDDas on Codeforces (opens in a new tab)
6Petr and a Combination LockCodeforcesEasy 1200Solve Petr and a Combination Lock on Codeforces (opens in a new tab)
7Pow(x, n)LeetCodeMedium Solve Pow(x, n) on LeetCode (opens in a new tab)
8Count Good NumbersLeetCodeMedium Solve Count Good Numbers on LeetCode (opens in a new tab)
9Sort an ArrayLeetCodeMedium Solve Sort an Array on LeetCode (opens in a new tab)
10K-th Symbol in GrammarLeetCodeMedium Solve K-th Symbol in Grammar on LeetCode (opens in a new tab)
11Find the Winner of the Circular GameLeetCodeMedium Solve Find the Winner of the Circular Game on LeetCode (opens in a new tab)

Linked List

0/14

A singly linked list stores nodes that point to their successor, so insertion and deletion are O(1) once you hold the right node, but reaching the k th node takes O(k)…

Pattern guide
Linked List questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Middle of the Linked ListLeetCodeEasy Solve Middle of the Linked List on LeetCode (opens in a new tab)
2Reverse Linked ListLeetCodeEasy Solve Reverse Linked List on LeetCode (opens in a new tab)
3Merge Two Sorted ListsLeetCodeEasy Solve Merge Two Sorted Lists on LeetCode (opens in a new tab)
4Remove Linked List ElementsLeetCodeEasy Solve Remove Linked List Elements on LeetCode (opens in a new tab)
5Linked List CycleLeetCodeEasy Solve Linked List Cycle on LeetCode (opens in a new tab)
6Intersection of Two Linked ListsLeetCodeEasy Solve Intersection of Two Linked Lists on LeetCode (opens in a new tab)
7Palindrome Linked ListLeetCodeEasy Solve Palindrome Linked List on LeetCode (opens in a new tab)
8Remove Nth Node From End of ListLeetCodeMedium Solve Remove Nth Node From End of List on LeetCode (opens in a new tab)
9Odd Even Linked ListLeetCodeMedium Solve Odd Even Linked List on LeetCode (opens in a new tab)
10Swap Nodes in PairsLeetCodeMedium Solve Swap Nodes in Pairs on LeetCode (opens in a new tab)
11Rotate ListLeetCodeMedium Solve Rotate List on LeetCode (opens in a new tab)
12Linked List Cycle IILeetCodeMedium Solve Linked List Cycle II on LeetCode (opens in a new tab)
13Reorder ListLeetCodeMedium Solve Reorder List on LeetCode (opens in a new tab)
14Copy List with Random PointerLeetCodeMedium Solve Copy List with Random Pointer on LeetCode (opens in a new tab)

Stack & Queue

0/12

A stack is last in, first out: the most recent unfinished item is always on top, which makes it the natural tool for matching brackets, evaluating expressions, undoing…

Pattern guide
Stack & Queue questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Valid ParenthesesLeetCodeEasy Solve Valid Parentheses on LeetCode (opens in a new tab)
2Implement Queue using StacksLeetCodeEasy Solve Implement Queue using Stacks on LeetCode (opens in a new tab)
3Remove All Adjacent Duplicates In StringLeetCodeEasy Solve Remove All Adjacent Duplicates In String on LeetCode (opens in a new tab)
4Jzzhu and ChildrenCodeforcesEasy 1000Solve Jzzhu and Children on Codeforces (opens in a new tab)
5Move BracketsCodeforcesEasy 1000Solve Move Brackets on Codeforces (opens in a new tab)
6Social Network (easy version)CodeforcesEasy 1000Solve Social Network (easy version) on Codeforces (opens in a new tab)
7YetnotherrokenKeoardCodeforcesEasy 1000Solve YetnotherrokenKeoard on Codeforces (opens in a new tab)
8Even PositionsCodeforcesEasy 1100Solve Even Positions on Codeforces (opens in a new tab)
9Min StackLeetCodeMedium Solve Min Stack on LeetCode (opens in a new tab)
10Evaluate Reverse Polish NotationLeetCodeMedium Solve Evaluate Reverse Polish Notation on LeetCode (opens in a new tab)
11Asteroid CollisionLeetCodeMedium Solve Asteroid Collision on LeetCode (opens in a new tab)
12Decode StringLeetCodeMedium Solve Decode String on LeetCode (opens in a new tab)

Math & Implementation

0/16

Implementation problems test whether you can translate a precise statement into correct code: simulate the process, handle every edge case, and choose types that do not…

Pattern guide
Math & Implementation questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1WatermelonCodeforcesEasy 800Solve Watermelon on Codeforces (opens in a new tab)
2Fizz BuzzLeetCodeEasy Solve Fizz Buzz on LeetCode (opens in a new tab)
3ElephantCodeforcesEasy 800Solve Elephant on Codeforces (opens in a new tab)
4Soldier and BananasCodeforcesEasy 800Solve Soldier and Bananas on Codeforces (opens in a new tab)
5Divisibility ProblemCodeforcesEasy 800Solve Divisibility Problem on Codeforces (opens in a new tab)
6Palindrome NumberLeetCodeEasy Solve Palindrome Number on LeetCode (opens in a new tab)
7Plus OneLeetCodeEasy Solve Plus One on LeetCode (opens in a new tab)
8Happy NumberLeetCodeEasy Solve Happy Number on LeetCode (opens in a new tab)
9Multiply by 2, divide by 6CodeforcesEasy 900Solve Multiply by 2, divide by 6 on Codeforces (opens in a new tab)
10Even OddsCodeforcesEasy 900Solve Even Odds on Codeforces (opens in a new tab)
11Odd DivisorCodeforcesEasy 900Solve Odd Divisor on Codeforces (opens in a new tab)
12Almost PrimeCodeforcesEasy 900Solve Almost Prime on Codeforces (opens in a new tab)
13Theatre SquareCodeforcesEasy 1000Solve Theatre Square on Codeforces (opens in a new tab)
14K-th Not Divisible by nCodeforcesEasy 1200Solve K-th Not Divisible by n on Codeforces (opens in a new tab)
15Count PrimesLeetCodeMedium Solve Count Primes on LeetCode (opens in a new tab)
16Next PermutationLeetCodeMedium Solve Next Permutation on LeetCode (opens in a new tab)

Mixed Practice

All patterns0/14

This set closes the Beginner level with fourteen problems drawn from all of its patterns: arrays and hashing, two pointers, strings, matrices, prefix sums, binary…

Pattern guide
Mixed Practice questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Stones on the TableCodeforcesEasy 800Solve Stones on the Table on Codeforces (opens in a new tab)
2Best Time to Buy and Sell StockLeetCodeEasy Solve Best Time to Buy and Sell Stock on LeetCode (opens in a new tab)
3Kefa and First StepsCodeforcesEasy 900Solve Kefa and First Steps on Codeforces (opens in a new tab)
4Lineland MailCodeforcesEasy 900Solve Lineland Mail on Codeforces (opens in a new tab)
5Young PhysicistCodeforcesEasy 1000Solve Young Physicist on Codeforces (opens in a new tab)
6Xenia and RingroadCodeforcesEasy 1000Solve Xenia and Ringroad on Codeforces (opens in a new tab)
7Traffic LightCodeforcesEasy 1000Solve Traffic Light on Codeforces (opens in a new tab)
8FenceCodeforcesEasy 1100Solve Fence on Codeforces (opens in a new tab)
9Vanya and LanternsCodeforcesEasy 1200Solve Vanya and Lanterns on Codeforces (opens in a new tab)
10Hexadecimal's NumbersCodeforcesEasy 1200Solve Hexadecimal's Numbers on Codeforces (opens in a new tab)
11Search a 2D MatrixLeetCodeMedium Solve Search a 2D Matrix on LeetCode (opens in a new tab)
12Rotate ArrayLeetCodeMedium Solve Rotate Array on LeetCode (opens in a new tab)
13Add Two NumbersLeetCodeMedium Solve Add Two Numbers on LeetCode (opens in a new tab)
14Find the Duplicate NumberLeetCodeMedium Solve Find the Duplicate Number on LeetCode (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