Binary String Requests

Problem Overview

  • Process two request types on a binary string: "count:<index>" (zeros up to and including index) and "flip" (invert all bits).
  • Input: binaryString of '0'/'1' and an array of request strings; Output: an array with counts corresponding to each "count" request in order.
  • Indexing is 0-based; requests may alternate; only "count" produces output.
  • Real-world domain: bitstring operations and data processing where toggles and prefix counts are queried.
  • Databricks coding interview problem; a common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: