Get Max Alternating Music

Amazon interviews problem: Given a binary string and an integer k (allowed flips), determine the length of the longest alternating substring (no two adjacent characters equal) that can be formed. This coding interview interview question asks you to evaluate how many changes are needed to maximize an alternating segment within the original string under the flip limit.

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: