Question bank › Strings
Dsa Strings Easy

Substring Search with Count

Write a function to count the occurrence of a substring in a given string. Example: Input: "ababcabc","abc" Output: 2 Input: "hellohello","lo" Output: 2 Note: The substring is counted for overlapping occurrences.

Key concepts

stringssubstringcounting

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.