![](https://img2018.cnblogs.com/blog/1853166/202001/1853166-20200126143013655-154923141.png) ![](https://img2018.cnblogs.com/blog/1853166/202001/18531... ...
export default (arr, n) => {
// 計數器
let max = 0
for (let i = 0, len = arr.length - 1; i < len; i++) {
if (arr[i] === 0) {
if (i === 0 && arr[1] === 0) {
max++
i++
} else if (arr[i - 1] === 0 && arr[i + 1] === 0) {
max++
i++
}
}
}
return max >= n
}