Pattern · Counting

Counting interview questions

97 counting problems tagged across recent interview reports. Drilled most heavily by paypal, roblox, and atlassian.

Founder's read

Counting is the most deceptively simple pattern: track frequency of elements and make decisions based on those counts. With 97 problems tagged on this pattern, it's everywhere. PayPal, Roblox, and Atlassian hammer candidates on counting variants, from anagram detection to divisibility checks. Most engineers underestimate it because the core mechanic is trivial, hash map, loop, compare, but the gotchas pile up fast in live assessments. StealthCoder solves counting problems in real time when you're stuck on a tricky constraint or edge case.

Most-asked counting problems

#ProblemDiff# Companies
01Majority ElementEASY27
02First Unique Character in a StringEASY15
03Majority Element IIMEDIUM5
04Count the Number of Good SubsequencesMEDIUM4
05Find Words That Can Be Formed by CharactersEASY4
06Least Number of Unique Integers after K RemovalsMEDIUM4
07Bulls and CowsMEDIUM3
08Check Whether Two Strings are Almost EquivalentEASY3
09Count Number of Pairs With Absolute Difference KEASY3
10Largest Palindromic NumberMEDIUM3
11Check If Array Pairs Are Divisible by kMEDIUM2
12Check if Number Has Equal Digit Count and Digit ValueEASY2
13Construct String With Repeat LimitMEDIUM2
14Count Elements With Maximum FrequencyEASY2
15Count Nice Pairs in an ArrayMEDIUM2
16Design Parking SystemEASY2
17Find Players With Zero or One LossesMEDIUM2
18Largest Color Value in a Directed GraphHARD2
19Longest Harmonious SubsequenceEASY2
20Longest Palindrome by Concatenating Two Letter WordsMEDIUM2
21Maximum Number of BalloonsEASY2
22Maximum Number of Balls in a BoxEASY2
23Maximum Palindromes After OperationsMEDIUM2
24Maximum Population YearEASY2
253Sum With MultiplicityMEDIUM1
26Apply Operations to Make String EmptyMEDIUM1
27Better Compression of StringMEDIUM1
28Check if All Characters Have Equal Number of OccurrencesEASY1
29Check if One String Swap Can Make Strings EqualEASY1
30Count Almost Equal Pairs IMEDIUM1
31Count AnagramsHARD1
32Count Common Words With One OccurrenceEASY1
33Count Pairs Of Similar StringsEASY1
34Count Tested Devices After Test OperationsEASY1
35Count the Number of Consistent StringsEASY1
36Count the Number of Vowel Strings in RangeEASY1
37Destroy Sequential TargetsMEDIUM1
38Detect SquaresMEDIUM1
39Determine if Two Strings Are CloseMEDIUM1
40Equal Sum Arrays With Minimum Number of OperationsMEDIUM1
41Find Consecutive Integers from a Data StreamMEDIUM1
42Find Longest Special Substring That Occurs Thrice IIMEDIUM1
43Find Valid Pair of Adjacent Digits in StringEASY1
44Furthest Point From OriginEASY1
45Identify the Largest Outlier in an ArrayMEDIUM1
46Increasing Decreasing StringEASY1
47Largest Combination With Bitwise AND Greater Than ZeroMEDIUM1
48Maximum Count of Positive Integer and Negative IntegerEASY1
49Maximum Difference Between Even and Odd Frequency IEASY1
50Maximum Number of Pairs in ArrayEASY1

Showing top 50 of 97 counting problems by # companies asking.

The hedge for the live OA

You can't drill every counting variant before the assessment. StealthCoder runs invisibly during screen share and solves whichever variant they throw at you. No browser extension. No detection signature. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.

Get StealthCoder
What this means

Counting problems fall into three rough categories: frequency matching (do two strings have the same character counts), constraint satisfaction (do element frequencies meet some divisibility or parity rule), and reconstruction (build an output respecting frequency limits). Recognition is straightforward: if the problem asks 'how many', 'does every element appear exactly', or 'are these two things equivalent ignoring order', you're likely counting. The subtlety is in the constraint, sometimes you need counts alone, sometimes counts plus indices, sometimes counts plus the rule that you can swap or rearrange. Start with anagram and divisibility variants, then move to multi-character constraints like Bulls and Cows or string compression. When a hard counting variant hits your live OA and you're second-guessing the data structure or missing a parity edge case, StealthCoder reads the problem and delivers the solution invisibly.

Companies that hire most on counting

The honest play

97 counting problems. You won't drill them all. Pass anyway.

Counting is one of the patterns interviews actually filter on. Memorizing every variant in a week is a fantasy. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds, no matter which counting flavor lands in your live OA. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Counting interview FAQ

How many counting problems should I drill before an OA?+

Aim for 20-30. Start with basic anagram and frequency matching (Bulls and Cows, Check if Anagrams), then move to constraint variants (divisibility, digit counts). Counting is foundational; it shows up as a subproblem in many other patterns, so reps here pay compound dividends.

Which companies drill counting the hardest?+

PayPal, Roblox, Atlassian, and Goldman Sachs all have 13+ counting problems in their interview pools. Counting is especially common in fintech and payments (PayPal, Goldman Sachs) because of its ties to divisibility and parity checks on transaction data.

How do I recognize a counting problem in real time?+

Look for questions about frequency, equality of distributions, or whether two inputs are equivalent ignoring order. Keywords: 'anagram', 'character count', 'divisible by', 'equal occurrences', 'valid rearrangement'. If you're building a frequency map in your head, you're on a counting problem.

Do I need a hash map every time?+

Usually, yes. Hash maps (dicts in Python) are standard for O(n) frequency tracking. Edge cases: if the input is a small fixed alphabet (26 letters, 10 digits), an array works. If order matters and you need indices alongside counts, pair frequency maps with index tracking.

What's the hardest variant of counting I'll see?+

Multi-constraint problems like Check if Array Pairs are Divisible by K, where you must count pairs and ensure each pair's sum is divisible. These require frequency maps plus modular arithmetic logic. Drill constraint-based counting last.

Problem and frequency data sourced from public community-maintained interview-report repos. Problems and trademarks © LeetCode.