FastPrepBinary String Flip and Prefix Zero Counts
Problems/Binary String Flip and Prefix Zero Counts

Binary String Flip and Prefix Zero Counts

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Three ZipRecruiter new-grad OA reports describe flipping every bit in the whole string and counting zeros in an inclusive prefix. The strongest reports show that only count requests produce output. A conflict between them is settled by our recorded evidence. We supplied limits and a function signature.

Maintain binaryString under requests:

  • flip inverts every bit and emits no output.
  • count:index appends the number of zeros from index 0 through the valid zero-based index, inclusive.

Return count answers in request order.

Function

binaryPrefixZeroCounts(binaryString: String, requests: String[]) → int[]

Examples

Example 1

binaryString = "1111010"requests = ["count:4","count:6","flip","count:4","flip","count:2"]return = [1,2,4,0]

Prefix counts use the current inversion state without emitting values for flips.

Example 2

binaryString = "0"requests = ["count:0","flip","count:0"]return = [1,0]

The one bit changes from zero to one.

Constraints

  • 1 <= binaryString.length,requests.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

  • Earliest Time to Schedule a MeetingMathWorks · OAMathWorks interview questions
  • Earliest Meeting Start on a 24-Hour ClockIMC Trading · OAIMC Trading interview questions
  • Earliest Time to Schedule a MeetingMicrosoft · OAMicrosoft interview questions
  • Maximum Equalized Substrings After One Adjacent SwapVisa · OAVisa interview questions
  • Maximum Redundancy After One Segment FlipBloomberg LP · OABloomberg LP interview questions
  • Balanced Split String with WildcardsTwo Sigma · OATwo Sigma interview questions
  • Longest Balanced Substring After One SwapTekion · OATekion interview questions
  • Shortest Compressed Length After RemovalDRW · OADRW interview questions
  • Count Special StringsAmazon · OA
  • Maximum Positive FeedbackTikTok · OATikTok 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[] binaryPrefixZeroCounts(String binaryString, String[] requests) {
        // Write your code here.
    }

}
Checking account…