FastPrepCount Overlapping Substring Occurrences
Problems/Count Overlapping Substring Occurrences

Count Overlapping Substring Occurrences

ZipRecruiter logoZipRecruiter● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes a source string, a target string, and counting equal substrings of the same length by start position. We supplied overlap, case sensitivity, a non-empty target, limits, and a function signature. Our version is about 86% the same as the reported question.

Count zero-based starting positions in source whose substring of length target.length equals target. Occurrences may overlap and matching is case-sensitive.

Function

countSubstringOccurrences(source: String, target: String) → int

Examples

Example 1

source = "aaaa"target = "aa"return = 3

Matches begin at positions zero, one, and two.

Example 2

source = "abcabc"target = "abc"return = 2

Two nonoverlapping occurrences are counted.

Constraints

  • 0 <= source.length <= 100000
  • 1 <= target.length <= 100000

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Fill One Exact-Length Binary WindowAmazon · OA
  • Remove Vowels from a StringHSBC · OAHSBC interview questions
  • Branch with the Most FilesCapital One · OACapital One interview questions
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Maximum Ones After K OperationsGoldman Sachs · OAGoldman Sachs interview questions
  • Total Each Letter's Count in an Encoded StringIBM · OAIBM interview questions
  • Robot Stops Left or Right (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
  • Count Palindrome Addition ChoicesThe D.E. Shaw Group · OAThe D.E. Shaw Group interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int countSubstringOccurrences(String source, String target) {
        // Write your code here.
    }

}
Checking account…