101 Logo
onenoughtone

DSA Problems

Problem Collection

Practice these problems to strengthen your understanding of data structures and algorithms. Filter by difficulty, category, or search for specific problems.

Filter Problems

Problems (87)

String End Trimmer
Medium

Find the minimum length of a string after repeatedly removing equal characters from both ends.

Two PointersString
Category: Strings

Character Rearrangement
Medium

Rearrange characters in a string so that no two adjacent characters are the same.

Hash TableStringGreedySortingHeap (Priority Queue)Counting
Category: Strings

Word Frequency Analyzer
Medium

Find the k most frequent words in an array, sorted by frequency and alphabetically.

Hash TableStringSortingHeap (Priority Queue)Counting
Category: Strings

Character Frequency Sorter
Medium

Sort characters in a string based on their frequency of occurrence.

Hash TableStringSortingHeap (Priority Queue)Counting
Category: Strings

Text Insertion Checker
Medium

Determine if two sentences can be made identical by inserting additional words into one of them.

ArrayStringTwo Pointers
Category: Strings

Palindrome Checker
Easy

Determine if a string reads the same forward and backward.

String ManipulationTwo Pointers
Category: Strings

Scramble String
Hard

Determine if one string is a scrambled version of another string.

StringDynamic ProgrammingRecursion
Category: Strings

Message Encryption
Easy

Reverse a string to create a simple encryption system.

String ManipulationIn-place Modification
Category: Strings

Word Puzzle Challenge
Easy

Check if two strings are anagrams of each other.

String ManipulationHash Table
Category: Strings

DNA Sequence Analysis
Medium

Find the longest common prefix among a set of strings.

String ManipulationArray Processing
Category: Strings

File Compression System
Medium

Compress a string by replacing repeated characters with counts.

String ManipulationRun-Length Encoding
Category: Strings

Email Filter System
Hard

Implement a pattern matching algorithm for filtering emails.

String ManipulationDynamic Programming
Category: Strings

Factorial Calculator
Easy

Calculate the factorial of a number using recursion.

RecursionMath
Category: Recursion

Fibonacci Sequence
Easy

Generate the Fibonacci sequence using recursion.

RecursionDynamic Programming
Category: Recursion

Library Book Finder
Easy

Implement a binary search algorithm to find a book's position in a sorted catalog.

RecursionDivide & ConquerBinary SearchSearching
Category: Recursion

Tower of Hanoi
Medium

Solve the Tower of Hanoi puzzle using recursion.

RecursionProblem Solving
Category: Recursion

Digital Paint Bucket Tool
Medium

Implement a flood fill algorithm for a digital art application's paint bucket tool.

RecursionDFSGraphMatrix
Category: Recursion

Shift Scheduler
Medium

Generate all possible permutations of a set.

RecursionBacktracking
Category: Recursion

Hiking Backpack Packer
Medium

Find if there exists a subset of elements that sum to a target value.

RecursionDynamic Programming
Category: Recursion

Prime Factor Sequence
Medium

Find the nth number whose prime factors are limited to 2, 3, and 5.

Hash TableMathDynamic ProgrammingHeap (Priority Queue)
Category: Dynamic Programming

Balloon Popping Strategy
Hard

Find the maximum number of coins you can collect by bursting balloons in the optimal order.

ArrayDynamic Programming
Category: Dynamic Programming

Terrain Navigator
Hard

Find the length of the longest increasing path in a matrix where you can move in four directions.

ArrayDynamic ProgrammingDepth-First SearchBreadth-First SearchGraphTopological SortMemoizationMatrix
Category: Dynamic Programming

Prime Factor Sequence
Medium

Find the nth super ugly number in a sequence where each number's prime factors are limited to a specific set.

ArrayMathDynamic ProgrammingHeap (Priority Queue)
Category: Dynamic Programming

Secret Message Decoder
Medium

Determine the total number of ways to decode a message where letters are represented by numbers.

StringDynamic ProgrammingRecursion
Category: Dynamic Programming

Tree Structure Counter
Medium

Calculate the number of structurally unique binary search trees that can be formed with n nodes.

Dynamic ProgrammingMathTreeBinary Search Tree
Category: Dynamic Programming

DNA Sequence Matcher
Hard

Count the number of distinct subsequences of one string that equal another string.

StringDynamic Programming
Category: Dynamic Programming

Number Pattern Generator
Easy

Generate the first n rows of Pascal's Triangle, where each number is the sum of the two numbers directly above it.

ArrayDynamic Programming
Category: Dynamic Programming

Row Extractor
Easy

Return a specific row from Pascal's Triangle efficiently without generating the entire triangle.

ArrayDynamic Programming
Category: Dynamic Programming

Maximal Rectangle
Hard

Find the largest rectangle containing only 1's in a binary matrix.

Dynamic ProgrammingStackMatrixHistogram
Category: Dynamic Programming

Regular Expression Matcher
Hard

Implement a regular expression matcher with support for '.' and '*' patterns.

Dynamic ProgrammingStringRecursionPattern Matching
Category: Dynamic Programming

Painting a Grid
Hard

Count ways to paint an m×n grid with three colors such that no adjacent cells have the same color.

Dynamic ProgrammingCombinatoricsMatrix
Category: Dynamic Programming

Parentheses Validator
Hard

Find the length of the longest valid parentheses substring.

Dynamic ProgrammingStringStack
Category: Dynamic Programming

Special Subsequence Counter
Hard

Count the number of special subsequences in a binary array.

Dynamic ProgrammingArraySubsequence
Category: Dynamic Programming

Rain Water Collector
Hard

Calculate how much rainwater can be trapped between buildings of varying heights.

Dynamic ProgrammingArrayTwo PointersStack
Category: Dynamic Programming

Wildcard Pattern Matcher
Hard

Implement a wildcard pattern matcher with support for '?' and '*' patterns.

Dynamic ProgrammingStringGreedyPattern Matching
Category: Dynamic Programming

Largest Integer Former
Hard

Form the largest integer with digits that add up to a target sum.

Dynamic ProgrammingGreedyBacktracking
Category: Dynamic Programming

Largest Plus Sign Finder
Medium

Find the largest plus sign of 1's in a grid of 0's and 1's.

Dynamic ProgrammingMatrixPrefix Sum
Category: Dynamic Programming

Palindromic Subsequence Finder
Medium

Find the length of the longest palindromic subsequence in a string.

Dynamic ProgrammingStringPalindrome
Category: Dynamic Programming

Palindromic Substring Finder
Medium

Find the longest palindromic substring in a string.

Dynamic ProgrammingStringPalindrome
Category: Dynamic Programming

Maximum Subarray Finder
Medium

Find the maximum sum of a subarray with at most one element deletion.

Dynamic ProgrammingArrayKadane's Algorithm
Category: Dynamic Programming

Fibonacci Subsequence Finder
Medium

Find the length of the longest Fibonacci subsequence in an array.

Dynamic ProgrammingArrayHash Table
Category: Dynamic Programming

Array Increaser
Hard

Make an array strictly increasing by replacing elements.

Dynamic ProgrammingArrayBinary Search
Category: Dynamic Programming

Climbing Stairs
Easy

Count the number of ways to climb a staircase taking 1 or 2 steps at a time.

Dynamic ProgrammingFibonacciRecursion
Category: Dynamic Programming

House Robber
Medium

Find the maximum amount of money you can rob without alerting the police.

Dynamic ProgrammingArray
Category: Dynamic Programming

House Robber II
Medium

Rob houses arranged in a circle without alerting the police.

Dynamic ProgrammingArrayCircular Array
Category: Dynamic Programming

Unique Paths
Medium

Count the number of unique paths from top-left to bottom-right of a grid.

Dynamic ProgrammingCombinatoricsMath
Category: Dynamic Programming

Unique Paths II
Medium

Count unique paths in a grid with obstacles.

Dynamic ProgrammingArrayMatrix
Category: Dynamic Programming

Minimum Path Sum
Medium

Find the path with the minimum sum from top-left to bottom-right in a grid.

Dynamic ProgrammingArrayMatrix
Category: Dynamic Programming

Target Sum
Medium

Find the number of ways to assign + and - to reach a target sum.

Dynamic ProgrammingDFSBacktracking
Category: Dynamic Programming

Partition Equal Subset Sum
Medium

Determine if an array can be partitioned into two equal sum subsets.

Dynamic ProgrammingArraySubset Sum
Category: Dynamic Programming

Ones and Zeroes
Medium

Find the maximum number of strings that can be formed with given limits of 0s and 1s.

Dynamic ProgrammingArrayString
Category: Dynamic Programming

Longest Turbulent Subarray
Medium

Find the length of the longest turbulent subarray.

Dynamic ProgrammingArraySliding Window
Category: Dynamic Programming

Minimum Insertions for Palindrome
Hard

Find the minimum number of insertions needed to make a string palindromic.

Dynamic ProgrammingStringPalindrome
Category: Dynamic Programming

Count Vowels Permutation
Hard

Count the number of strings of length n that consist only of vowels and follow specific rules.

Dynamic ProgrammingCombinatorics
Category: Dynamic Programming

Dice Roll Simulation
Hard

Count the number of distinct sequences that can be obtained with dice rolls.

Dynamic ProgrammingProbability
Category: Dynamic Programming

Domino and Tromino Tiling
Medium

Count the number of ways to tile a 2 x n board with dominos and trominos.

Dynamic ProgrammingCombinatorics
Category: Dynamic Programming

Best Time to Buy and Sell Stock
Easy

Find the maximum profit from buying and selling a stock once.

Dynamic ProgrammingArrayGreedy
Category: Dynamic Programming

Best Time to Buy and Sell Stock III
Hard

Find the maximum profit from buying and selling stocks with at most two transactions.

Dynamic ProgrammingArray
Category: Dynamic Programming

Best Time to Buy and Sell Stock IV
Hard

Find the maximum profit from buying and selling stocks with at most k transactions.

Dynamic ProgrammingArray
Category: Dynamic Programming

Best Time to Buy and Sell Stock with Cooldown
Medium

Find the maximum profit with a cooldown period after selling.

Dynamic ProgrammingArrayState Machine
Category: Dynamic Programming

Best Time to Buy and Sell Stock with Transaction Fee
Medium

Find the maximum profit with a transaction fee for each trade.

Dynamic ProgrammingArrayGreedy
Category: Dynamic Programming

Best Team with No Conflicts
Medium

Find the maximum score of a team with no age-score conflicts.

Dynamic ProgrammingArraySorting
Category: Dynamic Programming

Knight Dialer
Medium

Count the number of distinct phone numbers of length n that a chess knight can dial.

Dynamic ProgrammingGraph
Category: Graphs

Knight Probability in Chessboard
Medium

Calculate the probability that a knight remains on the board after k moves.

Dynamic ProgrammingGraphProbability
Category: Graphs

Out of Boundary Paths
Medium

Count the number of paths to move a ball out of a grid boundary.

Dynamic ProgrammingGraphRecursion
Category: Graphs

Pancake Sorting
Medium

Sort an array using only pancake flips, where a pancake flip reverses the first k elements of the array.

ArrayTwo PointersGreedySorting
Category: Greedy

Token Strategy Game
Medium

Maximize your score by strategically playing tokens either face up or face down.

ArrayTwo PointersGreedySortingGame Theory
Category: Greedy

Rescue Boat Dispatcher
Medium

Determine the minimum number of boats required to rescue everyone, where each boat can carry at most 2 people.

ArrayTwo PointersGreedySorting
Category: Greedy

Reducing Dishes
Hard

Find the maximum sum of satisfaction you can get by cooking some dishes.

GreedyDynamic ProgrammingSorting
Category: Greedy

Schedule Validator
Easy

Determine if it's possible to attend all meetings without any conflicts.

ArraySorting
Category: Intervals

Dynamic Window Statistics
Hard

Find the median of each sliding window of size k in an array.

ArrayHash TableSliding WindowHeap (Priority Queue)Ordered Set
Category: Sliding Window

Continuous Median Tracker
Hard

Design a data structure that can efficiently add numbers from a data stream and find the median of all numbers added so far.

DesignTwo PointersData StreamSortingHeap (Priority Queue)
Category: Heap

Capital Investment Optimizer
Hard

Maximize capital by selecting projects with the highest profit that can be started with the current capital.

ArrayGreedySortingHeap (Priority Queue)
Category: Heap

Element Rank Finder
Medium

Find the kth largest element in an unsorted array without sorting the entire array.

ArrayDivide and ConquerSortingHeap (Priority Queue)QuickSelect
Category: Heap

Proximity Point Finder
Medium

Find the k closest points to the origin (0, 0) in a 2D plane.

ArrayMathDivide and ConquerGeometrySortingHeap (Priority Queue)QuickSelect
Category: Heap

Stream Data Processor
Easy

Design a class to find the kth largest element in a stream of numbers.

Heap (Priority Queue)DesignSortingData Stream
Category: Heap

Array Rotator
Medium

Rotate an array to the right by k steps, where elements that would go beyond the end wrap around to the beginning.

ArrayMathTwo Pointers
Category: Math

Square Number Decomposition
Medium

Determine if a non-negative integer can be expressed as the sum of two perfect squares.

MathTwo PointersBinary Search
Category: Math

Two Keys Keyboard
Medium

Find the minimum number of operations to get n 'A's using copy and paste.

Dynamic ProgrammingMathPrime Factorization
Category: Miscellaneous

Cherry Pickup
Hard

Collect maximum cherries in a grid by making two passes.

Dynamic ProgrammingGrid
Category: Miscellaneous

Cherry Pickup II
Hard

Collect maximum cherries with two robots moving simultaneously.

Dynamic ProgrammingGrid
Category: Miscellaneous

Combination Sum IV
Medium

Count the number of possible combinations that add up to a target.

Dynamic ProgrammingCombinatorics
Category: Miscellaneous

Dice Roll Simulation
Medium

Count the number of ways to get a target sum with n dice rolls.

Dynamic ProgrammingCombinatorics
Category: Miscellaneous

Profitable Schemes
Hard

Count the number of profitable schemes with given constraints.

Dynamic ProgrammingKnapsack
Category: Miscellaneous

Shopping Offers
Medium

Find the lowest price to buy items with special offers.

Dynamic ProgrammingRecursionMemoization
Category: Miscellaneous

Soup Servings
Medium

Calculate the probability of serving soup in a specific order.

Dynamic ProgrammingProbability
Category: Miscellaneous

Tallest Billboard
Hard

Find the tallest billboard possible with given rods.

Dynamic ProgrammingKnapsack
Category: Miscellaneous
ConceptProblemsPractice
101 Logo
onenoughtone