首页 > TAG信息列表 > zeroNum

leetcode474. 一和零

一:论语 二:timi 三:上码 class Solution { public: /** 思路:1.确定动态规划是因为满足的结果的答案不唯一 我们要选取最优的 2.联系背包问题是因为 子集中的元素都是只是用一次 3.动态规划五步走 1>:确定dp数组和

1004. Max Consecutive Ones III

This problem can be solved by sliding window: 1. firstly the right point, j, start to move, it it meet a zero, the zeroNum++, which means, we convert one 0 to 1. 2. If we converted too many 0s to 1, we need to move left point, i, forward, until we don