leetcode 995. K 连续位的最小翻转次数(Minimum Number of K Consecutive Bit Flips) 贪心
在仅包含0和1的数组A中,一次K位翻转包括选择一个长度为K的(连续)子数组,同时将子数组中的每个0更改为1,而每个1更改为0。返回所需的K位翻转的次数,以便数组没有值为0的元素。如果不可能,返回-1。示例1:输入:A=[0,1,0],K=1输出:2解释:先翻转A[0],然后翻转A[2]。示例2:输入:A=[1,1,0],K=2输出:-1解释:无论我们怎样翻转大小为2的子数组,我们都不能使数组变为[