Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Feature Description
You are given a binary array nums and an integer k.
A k-bit flip is choosing a subarray of length k from nums and simultaneously changing every 0 in the subarray to 1, and every 1 in the subarray to 0.
Return the minimum number of k-bit flips required so that there is no 0 in the array. If it is not possible, return -1.
A subarray is a contiguous part of an array.
Use Case
Input: nums = [0,1,0], k = 1
Output: 2
Benefits
No response
Add ScreenShots
No response
Priority
High
Record
- I have read the Contributing Guidelines
- I'm a GSSOC'24 contributor
- I have starred the repository