Search
⌘K
Get Premium
Leetcode 2134. Minimum Swaps to Group All 1's Together II
Given a binary circular array, find the minimum number of swaps needed to group all 1's contiguously anywhere in the circle. This reduces to finding a length-k circular window (k = total number of 1's) with the fewest 0's — a sliding-window/linear-time optimization over the circular array.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.