Google | Phone | Minimum visible red in ribbon
Anonymous User
1557

Given a ribbon that has blue parts and red parts represented as "b" or "r", and given K blue bands of bands of length L.
If you can cover the ribbon with bands, what is the minimum amount of visible red in the ribbon?
Ex:
Ribbon is "rrbbrbrrrbbrrbr"
3 bands of length 3 represented as "bbb", "bbb", and "bbb"
Output should be 2
"rrbbrbrrrbbrrbr" becomes
"[bbb]brb[bbb]bb[bbb]r

Comments (8)