enumeration
enumeration 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
Count Primes
Count all prime numbers less than a given integer n using efficient array and math-based enumeration techniques.
Largest Palindrome Product
Find the largest palindromic number from the product of two n-digit integers using math and enumeration efficiently.
Ambiguous Coordinates
Find all valid 2D coordinate possibilities for an ambiguous input string using backtracking and pruning techniques.
Consecutive Numbers Sum
Find the number of ways to express a number as the sum of consecutive positive integers.
Longest Mountain in Array
Find the length of the longest subarray forming a mountain pattern using state transitions and two-pointer logic efficie…
Reordered Power of 2
Determine if a number's digits can be rearranged to form a power of two using counting and hash-based checks.
Super Palindromes
Count all super-palindromes in a given numeric range, where each is a palindrome and square of a palindrome.
Largest Time for Given Digits
Given four digits, determine the latest valid 24-hour time possible using each digit exactly once with backtracking.
Powerful Integers
Find all integers that can be expressed as x^i + y^j up to a given bound using a Hash Table plus Math approach.
Sequential Digits
Find all integers within a range whose digits form a strictly increasing consecutive sequence using enumeration techniqu…
Count Good Triplets
Count Good Triplets requires identifying all triplets in an array that satisfy multiple absolute difference constraints …
Detect Pattern of Length M Repeated K or More Times
Determine if a subarray of length m repeats k or more consecutive times in a given integer array efficiently.
Maximum Number of Achievable Transfer Requests
Find the maximum number of achievable transfer requests between buildings with constraints on net employee transfers.
Count Subtrees With Max Distance Between Cities
This problem asks you to count subtrees in a tree structure where the maximum distance between any two cities matches sp…
Coordinate With Maximum Network Quality
Determine the coordinate with the maximum network quality by summing signal strengths from all reachable towers efficien…
Lexicographically Smallest String After Applying Operations
Optimize a string through rotations and additions to get the lexicographically smallest possible result using string man…
Count Substrings That Differ by One Character
Count all substrings from s that differ by exactly one character from some substring in t using precise substring compar…
Minimum Degree of a Connected Trio in a Graph
Find the minimum degree of a connected trio in a graph using enumeration over nodes and edges.
Splitting a String Into Descending Consecutive Values
Check if a string of digits can be split into descending consecutive values where the difference between them is 1.
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.
Count Square Sum Triples
Count Square Sum Triples asks to find the number of integer triples where a² + b² = c² for values between 1 and n.
Three Divisors
Determine if a given integer has exactly three positive divisors.
Check if Move is Legal
Determine if a move on an 8x8 board is legal by validating lines in all directions using array and matrix patterns.
Count Special Quadruplets
Count Special Quadruplets requires scanning arrays and using hash lookups to efficiently find quadruplets matching sum c…
Longest Subsequence Repeated k Times
Find the longest subsequence repeated k times in a string using backtracking search with pruning.
Check if Word Can Be Placed In Crossword
Determine if a word fits in a crossword grid using array and matrix checks, accounting for spaces, letters, and blocked …
Maximum Number of Ways to Partition an Array
Determine the maximum number of ways to split an array into equal sums using at most one element change, leveraging pref…
Count Number of Maximum Bitwise-OR Subsets
Determine the number of non-empty subsets that achieve the maximum bitwise OR using efficient backtracking and pruning s…
Next Greater Numerically Balanced Number
Find the smallest numerically balanced number greater than a given integer using backtracking search and pruning.
Sum of k-Mirror Numbers
This problem requires finding the sum of the n smallest k-mirror numbers by generating palindromes in base-k and base-10…
Finding 3-Digit Even Numbers
Generate unique 3-digit even numbers from a given array of digits with duplicates.
Recover the Original Array
Recover the Original Array helps you understand how to reverse-engineer an array from two subsets using array scanning a…
Maximum Good People Based on Statements
Determine the maximum number of good people in a group given mutual statements, using precise backtracking with pruning.
Minimum Cost to Set Cooking Time
Calculate the minimum fatigue to set a microwave cooking time using digit moves and pushes efficiently.
Removing Minimum Number of Magic Beans
Determine the minimum beans to remove so all remaining non-empty bags have equal beans using a greedy approach.
Maximum Points in an Archery Competition
In the "Maximum Points in an Archery Competition" problem, Bob aims to maximize his score while respecting Alice's arrow…
Minimize Result by Adding Parentheses to Expression
Enumerate every valid parenthesis placement around the plus sign and choose the expression with the smallest evaluated p…
Maximum Total Beauty of the Gardens
Determine the maximum total beauty of gardens by strategically planting flowers using binary search over achievable flow…
Number of Ways to Buy Pens and Pencils
Calculate all distinct ways to spend a fixed total on pens and pencils using a straightforward enumeration strategy.
Maximum Score of a Node Sequence
Find the maximum score of a valid node sequence in an undirected graph with given node scores and edges.
Count Lattice Points Inside a Circle
Count the number of lattice points inside at least one circle in a grid, based on given center and radius data.
Remove Digit From Number to Maximize Result
Determine the largest possible number by removing one specific digit using a greedy approach and string iteration.
K Divisible Elements Subarrays
Count all distinct subarrays with at most k elements divisible by p using array scanning and hash lookup techniques effi…
Naming a Company
The "Naming a Company" problem requires determining the number of valid distinct company names from a list of name ideas…
Greatest English Letter in Upper and Lower Case
Find the greatest English letter that exists in both lowercase and uppercase in a string using a hash table approach.
Sum of Numbers With Units Digit K
Determine the minimum set of positive integers whose units digits match k and sum exactly to num using DP patterns.
Number of Arithmetic Triplets
Count the number of arithmetic triplets in a given strictly increasing array with a specified difference.
Maximum Rows Covered by Columns
Select exactly numSelect columns from a binary matrix to maximize rows where all ones are covered efficiently using back…
Number of Common Factors
The problem asks to find the number of common factors of two positive integers a and b.
Number of Valid Clock Times
Calculate how many valid digital clock times can be formed by replacing unknown digits in a string format hh:mm.
Create Components With Same Value
Maximize the number of components in a tree with equal sums by carefully deleting edges using divisor-based logic.
Sum of Number and Its Reverse
Determine if a non-negative integer can be expressed as the sum of a number and its reverse using enumeration and math r…
Split Message Based on Limit
Split Message Based on Limit requires dividing a string into parts with length constraints using a calculated suffix pat…
Count Increasing Quadruplets
Given a permutation of numbers, count the number of increasing quadruplets using dynamic programming.
Form Smallest Number From Two Digit Arrays
Given two arrays of digits, find the smallest possible number formed by one digit from each array.
Maximum Strength of a Group
Maximize the strength of a student group by carefully selecting students based on their scores, using dynamic programmin…
Collecting Chocolates
Calculate the minimum cost to collect all chocolate types using rotations and purchases in an array-based enumeration pa…
Minimum Operations to Make the Integer Zero
This problem challenges you to compute the minimum operations to reduce an integer to zero using bit manipulation and st…
Prime Pairs With Target Sum
Find all prime number pairs that sum up to a given integer n using an efficient sieve-based array approach.
Longest Alternating Subarray
Find the longest alternating subarray in a given array of integers.
Number of Black Blocks
Calculate the number of black blocks in a grid given a list of black cell coordinates.
Sum of Squares of Special Elements
Calculate the sum of squares of special elements in a 1-indexed array using index divisibility checks efficiently.
Shortest String That Contains Three Strings
Find the shortest string containing three given strings using a greedy approach while ensuring it is lexicographically s…
Count Symmetric Integers
Count Symmetric Integers finds numbers where the sum of the first half of digits equals the sum of the second half withi…
Minimum Operations to Make a Special Number
Minimize operations to make a number divisible by 25 by deleting digits. Use greedy choice and invariant validation.
Happy Students
The Happy Students problem asks how many ways a teacher can select a group of students so everyone is happy, based on ce…
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…
Distribute Candies Among Children II
Determine how to distribute n candies among 3 children without exceeding a limit on individual candies.
Minimum Operations to Maximize Last Elements in Arrays
Minimize the number of operations needed to maximize the last elements of two arrays with specific swaps.
Count Beautiful Substrings I
Given a string and a value k, count the number of beautiful substrings where vowels * consonants % k == 0.
Find the Peaks
Identify all peaks in a mountain array using direct array enumeration and strict neighbor comparisons efficiently.
Number of Possible Sets of Closing Branches
Calculate all valid sets of branch closures while keeping remaining branches within maxDistance using bitmask and graph …
Count the Number of Incremovable Subarrays I
Count the number of incremovable subarrays in an array by removing them to create a strictly increasing sequence.
Maximum Square Area by Removing Fences From a Field
This problem challenges you to calculate the largest square area possible by removing fences from a given rectangular fi…
Minimum Moves to Capture The Queen
Determine the fewest moves to capture the black queen using only white pieces with careful position analysis.
Divide an Array Into Subarrays With Minimum Cost I
Divide an array into three contiguous subarrays with minimum cost by leveraging array and sorting principles.
Find the Maximum Number of Elements in Subset
This problem asks you to find the maximum subset size where each number in the subset follows a specific pattern with ha…
Find the Number of Ways to Place People I
Calculate how many valid pairs of points can be formed on a 2D plane using array and math enumeration techniques efficie…
Find the Number of Ways to Place People II
Calculate all valid placements of people on a 2D grid ensuring Alice can fence herself with Bob without enclosing others…
Most Frequent Prime
Find the most frequent prime over 10 from numbers generated by scanning a 2D matrix in all straight directions efficient…
Apply Operations to Make Sum of Array Greater Than or Equal to k
Given an array nums, find the minimum number of operations to make the sum of elements greater than or equal to k.
Latest Time You Can Obtain After Replacing Characters
Given a time string with "?" characters, replace them to form the latest valid 12-hour time.
Make a Square with the Same Color
Determine if a 3x3 grid can form a 2x2 square of the same color by changing at most one cell efficiently.
Find the Integer Added to Array II
Given two arrays nums1 and nums2, determine the integer added to nums1 to make it equal to nums2 after removing two elem…
Minimum Cost to Equalize Array
Compute the minimum cost to make all elements equal using selective operations guided by greedy choices and invariant ch…
Find the Minimum Area to Cover All Ones II
Find the minimum area to cover all 1's in a 2D binary grid using three non-overlapping rectangles.
Maximum Height of a Triangle
Find the maximum height of a triangle that can be formed using red and blue balls under given constraints.
Count the Number of Substrings With Dominant Ones
Count the number of substrings in a binary string with dominant ones, using a sliding window approach with state updates…
Maximum Value Sum by Placing Three Rooks I
Maximize the value sum by placing three rooks on a chessboard while ensuring they do not attack each other.
Maximum Value Sum by Placing Three Rooks II
Maximize the sum by placing three non-attacking rooks on a chessboard with dynamic programming.
Count Almost Equal Pairs I
Count Almost Equal Pairs I involves finding pairs of elements that can be made equal by swapping at most one digit.
Count Almost Equal Pairs II
Count the number of almost equal integer pairs in an array using array scanning and hash lookup efficiently.
Find the Count of Good Integers
Count good integers by rearranging digits to form k-palindromic numbers, leveraging hash tables and math techniques.
Maximum Possible Number by Binary Concatenation
Determine the largest number achievable by reordering three integers and concatenating their binary forms efficiently.
Smallest Divisible Digit Product I
Find the smallest number greater than or equal to n whose digit product is divisible by t.
Identify the Largest Outlier in an Array
Identify the largest outlier in an integer array using scanning and hash lookup for efficient detection and validation.
Maximum Area Rectangle With Point Constraints I
Find the maximum area of a rectangle formed by given points on a plane with unique coordinates.
Minimum Operations to Make Character Frequencies Equal
This Hard problem asks to transform a string so all character frequencies match using minimal deletions, leveraging dyna…
Smallest Substring With Identical Characters I
Minimize the length of the longest substring with identical characters after at most numOps changes in a binary string.
Find the Lexicographically Largest String From the Box I
This problem involves finding the lexicographically largest string from a given word using a two-pointer approach.
Count Special Subsequences
Count the number of special subsequences in an array of positive integers, focusing on efficient array scanning and hash…
Maximum Subarray With Equal Products
This problem involves finding the longest subarray where the product equals the LCM multiplied by the GCD, leveraging a …
Maximum Frequency After Subarray Operation
Determine the maximum frequency of a target value k after applying one subarray addition operation efficiently using arr…
Frequencies of Shortest Supersequences
Compute all unique shortest common supersequences of given words using graph indegree tracking and topological ordering …
Reschedule Meetings for Maximum Free Time II
Maximize free time by rescheduling at most one meeting using a greedy choice with invariant validation approach for arra…
Maximum Difference Between Even and Odd Frequency II
Find the maximum difference between even and odd character frequencies in substrings using sliding window updates effici…
Permutations IV
Find the k-th alternating permutation of numbers 1 to n, ensuring no adjacent numbers share parity, using array and math…
Maximize Subarrays After Removing One Conflicting Pair
Maximize the count of subarrays after removing one conflicting pair using array traversal and segment tree logic efficie…
Unique 3-Digit Even Numbers
Given an array of digits, find how many distinct 3-digit even numbers can be formed without repetition of digits and no …
Maximize Active Section with Trade I
Maximize the number of active sections in a binary string by performing at most one trade operation.
Longest Palindrome After Substring Concatenation I
Compute the maximum palindrome length by concatenating substrings from two strings using state transition dynamic progra…
Number of Unique XOR Triplets II
Count all unique XOR results from triplets in an integer array using array traversal and bit manipulation techniques eff…
Equal Sum Grid Partition I
Determine if an m x n matrix grid can be split into two non-empty sections with equal sums by making a single horizontal…
Equal Sum Grid Partition II
Determine if a matrix can be partitioned into two sections with an equal sum using a single cut.
Partition Array into Two Equal Product Subsets
Determine if you can partition an array into two subsets with equal product using recursion and bit manipulation.
Maximize Subarray GCD Score
Maximize Subarray GCD Score focuses on maximizing a subarray's score by using at most k doubling operations on an array …
Find Maximum Area of a Triangle
Find the maximum area of a triangle from 2D coordinates with at least one side parallel to the x-axis or y-axis.
Partition Array for Maximum XOR and AND
Partition the array into three subsequences to maximize XOR and AND operations with a greedy approach.