Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Can we use a breadth-first search to find the minimum number of operations?
Find the beginning and end indices of the subarray of size k that can be reversed to bring 1 to a particular position.
Can we visit every index or do we need to consider the parity of k?