Maximize Number of Intervals with Shoes

Given a string S consisting of letters 'L' and 'R' representing left and right shoes, find the maximum number of intervals such that each interval contains an equal number of 'L's and 'R's. Implemen...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: