Maximize Consecutive Dance Moves

Problem Overview

  • Given a binary string of dance moves (1) and pauses (0) and an integer k, you may flip exactly k distinct positions.
  • Return the maximum number of adjacent '11' pairs in the final string, i.e., count indices i where s[i]='1' and s[i+1]='1'.
  • Reflects optimizing smooth transitions in a TikTok dance challenge.
  • Asked in TikTok interviews; a common coding interview problem and interview question; constraints are unspecified.

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: