Module 02
DSA Basics
Ninety problems that build loop, array and string fluency — from warm-ups to exam-level questions.
Before patterns come fundamentals. These problems are short stories about stalls, classrooms and queues that train you to turn words into loops, counters, prefix sums, two pointers and hash maps. Every problem runs in your browser in C, C++, Java or Python, with hidden tests and reference solutions in all four.
- Write array and string loops without off-by-one errors
- Use counting, prefix sums, two pointers and hash maps by reflex
- Handle edge cases (empty input, duplicates, negatives) the hidden tests check for
- Solve the typical online-assessment coding question in under 20 minutes
90
problems
8
free to start
~38h
of study
01
Warm-up
Single passes, counters and simple conditions. Get comfortable with the editor and the judge.
| 01 | The Juice Stall TakingsFree | Single pass · running total | Easy | |
| 02 | Who Cleared the Cut-OffFree | Single pass · counting with a condition | Easy | |
| 03 | The Mirror NameplateFree | Two pointers from both ends | Easy | |
| 04 | The Tallest Building on the SkylineFree | Single pass · running maximum | Easy | |
| 05 | Turn the Queue AroundFree | Two pointers · in-place reverse | Easy | |
| 06 | Counting the Vowels in a Slogan | Single pass over characters | Easy | |
| 07 | The Runner-Up Score | Single pass · two running values | Easy | |
| 08 | Finding the Roll Number on the List | Linear search | Easy | |
| 09 | The Backwards Wi-Fi Password | Building a string backwards | Easy | |
| 10 | How Many Times Does That Letter Appear | Single pass over characters | Easy | |
| 11 | The Lucky Bill Number | Character to digit · running total | Easy | |
| 12 | Counting Words in the Notice | Single pass with a state flag | Easy | |
| 13 | Is the Token Queue in Order | Compare neighbours in one pass | Easy | |
| 14 | Squeeze Out the Spaces | Build a filtered string | Easy | |
| 15 | The Week's Temperature Swing | Running maximum and minimum | Easy | |
| 16 | Even-Numbered Seats | Single pass · counting with a condition | Easy | |
| 17 | Swap the Ends of the Row | Direct index access | Easy | |
| 18 | The Shouting Version of the Message | Character transformation | Easy | |
| 19 | One Row of the Marks Sheet | Indexing into a 2D array | Easy | |
| 20 | Digits Hidden in the Address | Character classification | Easy | |
| 21 | The Cricket Team's Batting Product | Running product · overflow awareness | Easy | |
| 22 | Above the Class Average | Two passes · derive then compare | Easy | |
| 23 | Fixing the Typo in the Poster | Character replacement | Easy | |
| 24 | The Longest Word on the Slide | Scan words · keep the best | Easy | |
| 25 | The Whole Hall's Attendance | Nested loop over a grid | Easy | |
| 26 | Cancel Every Booking of One Slot | Build a filtered array | Easy | |
| 27 | Readings from the Odd Minutes | Stepping through indexes | Easy | |
| 28 | Shouted Words in the Chat | Character classification | Easy | |
| 29 | Is That Word in the Notice | Naive substring search | Easy | |
| 30 | Shuffling Two Decks Together | Two indexes walking together | Easy |
02
Building up
Frequency maps, prefix sums, two pointers, sorting and 2-D grids.
| 01 | Push the Empty Boxes to the BackFree | Write pointer (stable partition) | Easy | |
| 02 | Two Items for Exactly the Budget | Two pointers on a sorted array | Easy | |
| 03 | The One Letter Nobody Repeats | Frequency count · second pass | Easy | |
| 04 | Did They Just Jumble My Name | Frequency count · compare | Easy | |
| 05 | Read the Address Backwards | Split and rebuild | Easy | |
| 06 | The Best Three Overs | Fixed-size sliding window | Easy | |
| 07 | Rotate the Duty Roster | Reverse three times (rotation) | Medium | |
| 08 | One Entry per Visitor | Write pointer on a sorted array | Easy | |
| 09 | The Class Representative Vote | Pairing off votes (majority) | Medium | |
| 10 | Runs Between Two Overs | Prefix sums | Medium | |
| 11 | Pairs of Friends with the Same Age Gap | Hash set lookup | Medium | |
| 12 | The Longest Cheer | Run length in one pass | Easy | |
| 13 | Turning the Timetable on Its Side | Matrix transpose | Medium | |
| 14 | The Cross on the Chessboard | Indexing the diagonals | Easy | |
| 15 | Joining Two Merit Lists | Two pointers · merge | Medium | |
| 16 | Looking Up a Sorted Price List | Binary search | Medium | |
| 17 | The Best Stretch of Trading Days | Running best (Kadane) | Medium | |
| 18 | Short Code for the Chant | Run-length encoding | Medium | |
| 19 | Names for the Certificate | Word-start detection | Easy | |
| 20 | How Many Different Subjects | Hash set · counting distinct values | Easy | |
| 21 | The Missing Answer Sheet | Sum formula / arithmetic trick | Medium | |
| 22 | Who Came Back to the Counter First | Hash set while scanning | Medium | |
| 23 | The Shared Folder Name | Compare characters column by column | Medium | |
| 24 | Is the Slogan a Perfect Mirror | Two pointers with filtering | Medium | |
| 25 | Balancing the Luggage Trolley | Prefix sum · balance point | Medium | |
| 26 | Ladies' Compartment First | Stable partition into a new array | Easy | |
| 27 | Subjects Both Friends Are Taking | Hash set intersection | Medium | |
| 28 | The Letter the Chant Loves Most | Frequency array · pick the best | Medium | |
| 29 | One Buy, One Sell | Running minimum · best so far | Medium | |
| 30 | Rooms with a Sea View | Running maximum while scanning | Medium | |
| 31 | The Best Performing SectionFree | Best row of a grid | Easy | |
| 32 | How Often Does the Slogan Repeat | Naive pattern matching · counting | Medium | |
| 33 | Swap Only the Vowels | Two pointers with skipping | Medium | |
| 34 | Did Someone Rotate the Password | Rotation check by doubling | Medium | |
| 35 | Two Bills That Settle the Account | Hash map of what you have seen | Medium |
03
Exam level
The kind of problem that decides an online assessment — several ideas combined, tight edge cases.
| 01 | The Longest Stretch of New FacesFree | Variable sliding window with last-seen positions | Medium | |
| 02 | Counting the Balanced Shifts | Prefix sums in a hash map | Hard | |
| 03 | Everyone Else's Contribution | Prefix and suffix products | Hard | |
| 04 | The Shortest Delivery Run | Variable sliding window (shrink from the left) | Hard | |
| 05 | The Longest Run of Jersey Numbers | Hash set · count runs from their start | Hard | |
| 06 | Quarantine the Spoilt Shelves | Mark first, change afterwards | Hard | |
| 07 | Turning the Group Photo | Transpose then reverse each row | Hard | |
| 08 | The Watchman's Round | Spiral traversal with four boundaries | Hard | |
| 09 | The Longest Mirror Inside the Banner | Expand around every centre | Hard | |
| 10 | The Loudest Second of Every Minute | Monotonic deque over a sliding window | Hard | |
| 11 | A Thali with at Most k Flavours | Sliding window with a count map | Hard | |
| 12 | The Longest Winning Run with k Retakes | Sliding window with a budget | Hard | |
| 13 | Where the Jumbled Code Appears | Sliding window of letter counts | Hard | |
| 14 | Adding Two Very Long Bills | Digit-by-digit addition with a carry | Hard | |
| 15 | Almost a Mirror Word | Two pointers with one allowed skip | Hard | |
| 16 | Repainting the Longest Stripe | Sliding window with the most common letter | Hard | |
| 17 | Shifts with Exactly k Night Duties | Counting windows · at most k minus at most k−1 | Hard | |
| 18 | Seating the Team Together | Fixed window over a rearrangement | Hard | |
| 19 | The Smallest Token Nobody Took | Placing values at their own index | Hard | |
| 20 | Merging the Overlapping Bookings | Sort by start, then sweep | Hard | |
| 21 | The Best k by k Plot | 2D prefix sums | Hard | |
| 22 | The Word the Notice Repeats Most | Hash map of word counts | Medium | |
| 23 | Sorting the Letters by Popularity | Counting sort by frequency | Hard | |
| 24 | Rain on the Uneven Roof | Two pointers with running maximums | Hard | |
| 25 | The Shortest Notice That Says It All | Sliding window with a need count | Hard |