Maximum Number of Workers with Equal Left and Right Shoes

Problem Overview

  • Determine the maximum number of contiguous worker intervals so each has equal left and right shoes and all shoes are assigned.
  • Input: string S of 'L' and 'R' (length 2..100,000) with total Ls equal to Rs; Output: an integer for the maximum intervals.
  • Domain context: assigning workers to adjacent shoe segments with balanced pairs.
  • A classic coding interview problem and practical interview question involving string balance and partitioning.

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: