Counting Problems
and How to Spot Them
CodeStory tags 91 problems as Counting, and 53 of them are Medium. Count first, reason second, then solve the ten most asked.
Free signup brings 100 AI credits now and 100 more every month.
How the Counting Pattern Works
CodeStory covers the tell, the counting mechanism and the double count mistake.
Spot the tell. Your answer is how many, and the items repeat. Open CodeStory's Hash Table guide for the map behind most counting.
Learn the mechanism. Count first, reason second. Frequency maps and fixed arrays of counts reduce most of these problems to arithmetic on the counts, instead of another walk over the data. Practise maps in CodeStory's hash table problems and array problems.
Avoid the mistake. Counting pairs twice inflates your answer. If order does not matter, divide by two or count forward only. Strings hide counts too, so try CodeStory's string problems.
Most Asked Counting Problems
More companies set the problems at the top of this list.
- Number of Divisible SubstringsMedium4 companies
- Rank Teams by VotesMedium4 companies
- Largest Palindromic NumberMedium3 companies
- Maximum Number of Balls in a BoxEasy2 companies
- Construct String With Repeat LimitMedium2 companies
- Count Elements With Maximum FrequencyEasy2 companies
- Check If Array Pairs Are Divisible by kMedium2 companies
- Find Players With Zero or One LossesMedium2 companies
- Longest Harmonious SubsequenceEasy2 companies
- Maximum Number of Pairs in ArrayEasy1 company
Study, Compare and Solve Counting Problems
Follow CodeStory's order to make counting stick.
More to Practise Inside the App
CodeStory pairs patterns with interviews and career tools. Swipe for more.
Technique Drills
Drill one technique before you move to the next.
352 problemsOpenHiring Company Sets
Practise what a named company asks.
463 companiesOpenLive Coding Interview
Choose a role and code while questions arrive.
scored reportOpenVoice Interview Rounds
Speak your answers and meet follow ups.
32 topicsOpenDBMS Viva Prep
Face index, join and normalisation questions.
in Core CSOpenOOP Viva Prep
Defend your inheritance and polymorphism answers.
in Core CSOpenSystem Design Chapters
Study how systems get built, layer by layer.
27 chaptersOpenSQL Challenges
Query real tables and check every row.
39 questionsOpenAptitude Tests
Quant, logic, verbal and DI under a timer.
280 questionsOpenTimed Coding Assessments
Practise with marks and hidden tests.
37 papersOpenAlgorithm Animations
Follow every step on input you choose.
26 algorithmsOpenGuided AI Hints
Reveal hints gradually before you ask for review.
100 free creditsOpenResume Maker
Build your resume beside your practice record.
in the appOpenReadiness Score
See one score and your weakest area.
tracked dailyOpen
Sign up to collect 100 AI credits, then 100 more monthly. Start free in the app
Counting Problems FAQs
Start free with no card, or ask a mentor on a free call.
Start Practising CountingHow do I know a problem is a Counting problem?
CodeStory looks for two signs. Your answer is how many, and the items repeat.
How many Counting problems should I solve?
CodeStory advises ten to fifteen across the levels, which is enough to stop needing the hint. CodeStory shows all 91 tagged problems, split 32 Easy, 53 Medium and 6 Hard, so start with Easy and work up.
Which mistake costs the most in Counting problems?
Counting pairs twice costs the most. Divide by two when order does not matter, or count forward only.
What data structure suits Counting problems?
Frequency maps and fixed arrays of counts suit them, because they reduce the problem to arithmetic on the counts.
Is practising by pattern better than a problem sheet?
Yes. Sheets hand you problems, while CodeStory's patterns hand you the link between them, and that link carries over to unseen problems. CodeStory files every problem under its pattern.
Which Counting problems do companies ask most?
Number of Divisible Substrings and Rank Teams by Votes lead, both asked at 4 companies in CodeStory's catalogue. Largest Palindromic Number follows at 3 companies.
Is Counting practice free to start?
Yes. You start with no card, receive 100 AI credits at signup and get 100 more every month.
Want Help With Counting? Get a Free Callback
Name your dream role to CodeStory, and a mentor draws up your plan.
- 1CodeStory grades your level, from newcomer to interview ready.
- 2CodeStory walks you through online and campus batches, with timings that fit your calendar.
- 3You decide. No pressure, no payment on the call.