Curtain Factory — Max Aqua Curtains in Any Box

E · easyP · Verified PYQstrings

String of a/b chars (N length). Pack into boxes of L chars. Find box with MAXIMUM number of ‘a’ chars. Leftover chars after N//L groups form another box.

1<=L<=10, 1<=N<=50
Input
bbbaaababa
3
Output
3
chunk string in groups of L using range(0,len(s),L). Count 'a' in each chunk. Return max.
Groups of 3: bbb, aaa, bab, a. Max a count = 3 (group 2).
← COVID Handshake ProblemCycle Detection in Linked List (Floyd's Algorithm) →
Report an issue with this question