Play Segments

Problem Overview

  • Find the minimum count of initial segments Player 1 should play so their final score is greater than Player 2's.
  • Input: coins[n] with 1 for coin, 0 for no coin; Output: integer minimum segments; 1 ≤ n ≤ 1e5.
  • Context: a video game level where segments give +1 for a coin, −1 otherwise; Player 1 starts, Player 2 finishes the rest.
  • From Ibm interviews, this coding interview problem is a common interview question on array scoring and split decisions.

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: