Counting Problems
149 Counting LeetCode problems · Solve with AI-powered hints & step-by-step explanations.
Learn the coding interview patterns behind these problems.
Start with these
All Counting problems
169 Majority Element Easy229 Majority Element II Medium299 Bulls and Cows Medium347 Top K Frequent Elements Medium383 Ransom Note Easy387 First Unique Character in a String Easy451 Sort Characters By Frequency Medium594 Longest Harmonious Subsequence Easy621 Task Scheduler Medium692 Top K Frequent Words Medium767 Reorganize String Medium811 Subdomain Visit Count Medium819 Most Common Word Easy869 Reordered Power of 2 Medium884 Uncommon Words from Two Sentences Easy900 RLE Iterator Medium914 X of a Kind in a Deck of Cards Easy923 3Sum With Multiplicity Medium945 Minimum Increment to Make Array Unique Medium992 Subarrays with K Different Integers Hard1010 Pairs of Songs With Total Durations Divisible by 60 Medium1054 Distant Barcodes Medium1079 Letter Tile Possibilities Medium1090 Largest Values From Labels Medium1128 Number of Equivalent Domino Pairs Easy1160 Find Words That Can Be Formed by Characters Easy1189 Maximum Number of Balloons Easy1221 Split a String in Balanced Strings Easy1267 Count Servers that Communicate Medium1347 Minimum Number of Steps to Make Two Strings Anagram Medium1356 Sort Integers by The Number of 1 Bits Easy1366 Rank Teams by Votes Medium1370 Increasing Decreasing String Easy1394 Find Lucky Integer in an Array Easy1400 Construct K Palindrome Strings Medium1419 Minimum Number of Frogs Croaking Medium1481 Least Number of Unique Integers after K Removals Medium1497 Check If Array Pairs Are Divisible by k Medium1512 Number of Good Pairs Easy1519 Number of Nodes in the Sub-Tree With the Same Label Medium1603 Design Parking System Easy1657 Determine if Two Strings Are Close Medium1684 Count the Number of Consistent Strings Easy1704 Determine if String Halves Are Alike Easy1726 Tuple with Same Product Medium1737 Change Minimum Characters to Satisfy One of Three Conditions Medium1742 Maximum Number of Balls in a Box Easy1748 Sum of Unique Elements Easy1775 Equal Sum Arrays With Minimum Number of Operations Medium1781 Sum of Beauty of All Substrings Medium1782 Count Pairs Of Nodes Hard1790 Check if One String Swap Can Make Strings Equal Easy1814 Count Nice Pairs in an Array Medium1819 Number of Different Subsequences GCDs Hard1854 Maximum Population Year Easy1857 Largest Color Value in a Directed Graph Hard1876 Substrings of Size Three with Distinct Characters Easy1897 Redistribute Characters to Make All Strings Equal Easy1941 Check if All Characters Have Equal Number of Occurrences Easy1994 The Number of Good Subsets Hard2001 Number of Pairs of Interchangeable Rectangles Medium2006 Count Number of Pairs With Absolute Difference K Easy2013 Detect Squares Medium2014 Longest Subsequence Repeated k Times Hard2023 Number of Pairs of Strings With Concatenation Equal to Target Medium2025 Maximum Number of Ways to Partition an Array Hard2029 Stone Game IX Medium2048 Next Greater Numerically Balanced Number Medium2053 Kth Distinct String in an Array Easy2068 Check Whether Two Strings are Almost Equivalent Easy2085 Count Common Words With One Occurrence Easy2131 Longest Palindrome by Concatenating Two Letter Words Medium2148 Count Elements With Strictly Smaller and Greater Elements Easy2150 Find All Lonely Numbers in the Array Medium2170 Minimum Operations to Make the Array Alternating Medium2182 Construct String With Repeat Limit Medium2186 Minimum Number of Steps to Make Two Strings Anagram II Medium2190 Most Frequent Number Following Key In an Array Easy2206 Divide Array Into Equal Pairs Easy2225 Find Players With Zero or One Losses Medium2244 Minimum Rounds to Complete All Tasks Medium2248 Intersection of Multiple Arrays Easy2275 Largest Combination With Bitwise AND Greater Than Zero Medium2283 Check if Number Has Equal Digit Count and Digit Value Easy2284 Sender With Largest Word Count Medium2287 Rearrange Characters to Make Target String Easy2341 Maximum Number of Pairs in Array Easy2347 Best Poker Hand Easy2351 First Letter to Appear Twice Easy2364 Count Number of Bad Pairs Medium2384 Largest Palindromic Number Medium2404 Most Frequent Even Element Easy2416 Sum of Prefix Scores of Strings Hard2423 Remove Letter To Equalize Frequency Easy2442 Count Number of Distinct Integers After Reverse Operations Medium2453 Destroy Sequential Targets Medium2499 Minimum Total Cost to Make Arrays Unequal Hard2506 Count Pairs Of Similar Strings Easy2514 Count Anagrams Hard2526 Find Consecutive Integers from a Data Stream Medium2529 Maximum Count of Positive Integer and Negative Integer Easy2531 Make Number of Distinct Characters Equal Medium2547 Minimum Cost to Split an Array Hard2586 Count the Number of Vowel Strings in Range Easy2748 Number of Beautiful Pairs Easy2833 Furthest Point From Origin Easy2856 Minimum Array Length After Pair Removals Medium2870 Minimum Number of Operations to Make Array Empty Medium2960 Count Tested Devices After Test Operations Easy2981 Find Longest Special Substring That Occurs Thrice I Medium2982 Find Longest Special Substring That Occurs Thrice II Medium3005 Count Elements With Maximum Frequency Easy3016 Minimum Number of Pushes to Type Word II Medium3035 Maximum Palindromes After Operations Medium3039 Apply Operations to Make String Empty Medium3044 Most Frequent Prime Medium3046 Split the Array Easy3071 Minimum Operations to Write the Letter Y on a Grid Medium3081 Replace Question Marks in String to Minimize Its Value Medium3084 Count Substrings Starting and Ending with Given Character Medium3085 Minimum Deletions to Make String K-Special Medium3128 Right Triangles Medium3137 Minimum Number of Operations to Make Word K-Periodic Medium3138 Minimum Length of Anagram Concatenation Medium3144 Minimum Substring Partition of Equal Character Frequency Medium3153 Sum of Digit Differences of All Pairs Medium3184 Count Pairs That Form a Complete Day I Easy3185 Count Pairs That Form a Complete Day II Medium3186 Maximum Total Damage With Spell Casting Medium3223 Minimum Length of String After Operations Medium3228 Maximum Number of Operations to Move Ones to the End Medium3238 Find the Number of Winning Players Easy3265 Count Almost Equal Pairs I Medium3267 Count Almost Equal Pairs II Hard3312 Sorted GCD Pair Queries Hard3335 Total Characters in String After Transformations I Medium3337 Total Characters in String After Transformations II Hard3371 Identify the Largest Outlier in an Array Medium3389 Minimum Operations to Make Character Frequencies Equal Hard3438 Find Valid Pair of Adjacent Digits in String Easy3442 Maximum Difference Between Even and Odd Frequency I Easy3443 Maximum Manhattan Distance After K Changes Medium3467 Transform Array by Parity Easy3518 Smallest Palindromic Rearrangement II Hard3527 Find the Most Common Response Medium3541 Find Most Frequent Vowel and Consonant Easy3545 Minimum Deletions for At Most K Distinct Characters Easy3583 Count Special Triplets Medium3591 Check if Any Element Has Prime Frequency Easy