NeetCode #824LC-995HardGreedy
← Back to All Problems#824 · #995 · Minimum Number of K Consecutive Bit Flips(K 连续位的最小翻转次数)
📌 Problem Statement & Constraints
You are given a binary array
nums and an integer k. In one operation, choose a window of length k (starting at i with i + k <= n) and flip every bit in it. Return the minimum number of operations to make every element 1, or -1 if impossible. Constraints: 1 <= nums.length <= 10^5, 1 <= k <= nums.length.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!