LeetCodechevron_rightCategorieschevron_rightcombinatorics
label

combinatorics

49 problems
Easy: 3Medium: 14Hard: 32

combinatorics is one of the most repeated interview dimensions. Start with edge-safe fundamentals, then move into pattern-level trade-offs.

Interview Signal

Frequently tests problem modeling, edge handling, and verbal clarity.

Common Pitfall

Template-only answers break under follow-up questioning.

Practice Strategy

Practice in 3-5 problem rounds and always review complexity alternatives.

Recommended Progression

#TitleDifficulty
62

Unique Paths

Calculate the number of unique paths for a robot to move on an m x n grid with only right and down movements.

Medium
458

Poor Pigs

Find the minimum number of pigs required to determine the poisonous bucket within a set time using state transition dyna…

Hard
920

Number of Music Playlists

Solve the Number of Music Playlists problem with dynamic programming, focusing on state transitions and combinatorics to…

Hard
1201

Ugly Number III

Find the nth positive integer divisible by a, b, or c using binary search over the answer space efficiently and accurate…

Medium
1359

Count All Valid Pickup and Delivery Options

Count all valid pickup and delivery sequences for n orders where deliveries occur after pickups using dynamic programmin…

Hard
1467

Probability of a Two Boxes Having The Same Number of Distinct Balls

Compute the probability that two boxes contain the same number of distinct balls using careful combinatorial and DP meth…

Hard
1569

Number of Ways to Reorder Array to Get Same BST

Determine the number of ways to reorder an array to get the same binary search tree (BST) from its insertion order.

Hard
1621

Number of Sets of K Non-Overlapping Line Segments

Count all valid arrangements of k non-overlapping line segments on n points using state transition dynamic programming.

Medium
1641

Count Sorted Vowel Strings

Calculate the number of length-n strings with vowels only that are sorted lexicographically using state transitions.

Medium
1643

Kth Smallest Instructions

Find the kth smallest lexicographic instruction sequence for reaching a destination in a grid using state transition dyn…

Hard
1735

Count Ways to Make Array With Product

Determine the number of arrays of size n where the product equals k using prime factorization and combinatorial DP techn…

Hard
1830

Minimum Number of Operations to Make String Sorted

Calculate the minimum operations to sort a string using combinatorial math and string manipulation techniques efficientl…

Hard
1863

Sum of All Subset XOR Totals

Compute the sum of all subset XOR totals using a backtracking search with pruning for arrays of small size.

Easy
1866

Number of Ways to Rearrange Sticks With K Sticks Visible

Calculate the number of arrangements of n uniquely-sized sticks so exactly k sticks are visible using dynamic programmin…

Hard
1916

Count Ways to Build Rooms in an Ant Colony

Solve the problem of counting distinct ways to build rooms in an ant colony using dynamic programming and topological or…

Hard
2063

Vowels of All Substrings

Compute the total number of vowels in all substrings of a given string using efficient state transition dynamic programm…

Medium
2221

Find Triangular Sum of an Array

The problem asks for calculating the triangular sum of an array through repeated pairwise summation.

Medium
2338

Count the Number of Ideal Arrays

This problem involves counting the number of ideal arrays of a given length under certain conditions using state transit…

Hard
2400

Number of Ways to Reach a Position After Exactly k Steps

Find the number of ways to reach a position after exactly k steps on an infinite number line using dynamic programming.

Medium
2514

Count Anagrams

Learn to count distinct anagrams for a multi-word string using hash tables, math, and combinatorics efficiently.

Hard
2597

The Number of Beautiful Subsets

Count all non-empty subsets of an array where no two numbers have an absolute difference equal to k, using array scannin…

Medium
2842

Count K-Subsequences of a String With Maximum Beauty

Determine the number of k-length unique subsequences in a string that maximize the sum of character frequencies efficien…

Hard
2928

Distribute Candies Among Children I

Given two integers n and limit, find the number of ways to distribute n candies among 3 children, with no child receivin…

Easy
2929

Distribute Candies Among Children II

Determine how to distribute n candies among 3 children without exceeding a limit on individual candies.

Medium
2930

Number of Strings Which Can Be Rearranged to Contain Substring

Calculate how many strings of length n can be rearranged to contain "leet" using dynamic programming and combinatorics.

Medium
2954

Count the Number of Infection Sequences

Calculate all valid infection sequences in a line by using array positions and combinatorial math efficiently for n peop…

Hard
2963

Count the Number of Good Partitions

Calculate how many ways to partition an array into contiguous subarrays where no number repeats across segments using ha…

Hard
3116

Kth Smallest Amount With Single Denomination Combination

Find the kth smallest amount using only one coin denomination at a time, applying binary search efficiently over possibl…

Hard
3128

Right Triangles

Count all possible right triangles in a 2D boolean grid using array scanning and hash lookup for efficiency.

Medium
3154

Find Number of Ways to Reach the K-th Stair

Determine the total number of ways to reach the k-th stair using a state transition dynamic programming approach with co…

Hard
3179

Find the N-th Value After K Seconds

Solve for the N-th value after K seconds by simulating array updates and using prefix sum techniques.

Medium
3250

Find the Count of Monotonic Pairs I

Compute the number of monotonic pairs in an integer array using state transition dynamic programming efficiently.

Hard
3251

Find the Count of Monotonic Pairs II

This problem involves finding the count of monotonic pairs in an array using dynamic programming and combinatorics techn…

Hard
3272

Find the Count of Good Integers

Count good integers by rearranging digits to form k-palindromic numbers, leveraging hash tables and math techniques.

Hard
3312

Sorted GCD Pair Queries

Solve the Sorted GCD Pair Queries problem by efficiently counting and locating GCDs of all array pairs using hash mappin…

Hard
3317

Find the Number of Possible Ways for an Event

Given n performers, x stages, and y scores, calculate the number of possible ways to assign performers and score bands.

Hard
3343

Count Number of Balanced Permutations

Determine how many distinct permutations of a digit string are balanced using state transition dynamic programming effic…

Hard
3352

Count K-Reducible Numbers Less Than N

This problem challenges you to count the K-reducible numbers less than a given binary integer using dynamic programming.

Hard
3395

Subsequences with a Unique Middle Mode I

Count subsequences of size 5 with a unique middle mode in an integer array using hash table and combinatorics.

Hard
3405

Count the Number of Arrays with K Matching Adjacent Elements

Count the number of valid arrays with exactly k adjacent elements that are equal, using math and combinatorics technique…

Hard
3426

Manhattan Distances of All Arrangements of Pieces

This problem challenges you to calculate Manhattan distances in all valid arrangements of identical pieces on a grid.

Hard
3428

Maximum and Minimum Sums of at Most Size K Subsequences

Find the sum of the maximum and minimum elements of subsequences with at most k elements, using dynamic programming.

Medium
3461

Check If Digits Are Equal in String After Operations I

Simulate repeated adjacent digit sums modulo 10 until two digits remain, then check whether those final digits match.

Easy
3463

Check If Digits Are Equal in String After Operations II

Determine if repeated digit-sum operations on a numeric string reduce it to two equal digits using math and string techn…

Hard
3470

Permutations IV

Find the k-th alternating permutation of numbers 1 to n, ensuring no adjacent numbers share parity, using array and math…

Hard
3518

Smallest Palindromic Rearrangement II

Find the k-th lexicographically smallest palindromic rearrangement of a given palindromic string s.

Hard
3539

Find Sum of Array Product of Magical Sequences

Use state transition dynamic programming to count magical index sequences and accumulate weighted products without enume…

Hard
3577

Count the Number of Computer Unlocking Permutations

Calculate the total valid unlocking sequences for computers based on their complexity using array and combinatorics logi…

Medium
3621

Number of Integers With Popcount-Depth Equal to K I

Calculate the number of integers in a given range with a specific popcount-depth using state transition dynamic programm…

Hard

Related Patterns

Combinatorics LeetCode Problems: 49 Solutions