




Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Choose k 1s and determine how many steps are required to move them into 1 group.
Maintain a sliding window of k 1s, and maintain the steps required to group them.
When you slide the window across, should you move the group to the right? Once you move the group to the right, it will never need to slide to the left again.