摘要: class Solution { public int maxProduct(int[] nums) { int n = nums.length; int preMin = nums[0]; // i 之前最小值 int preMax = nums[0]; // i 之前最大值 int res = 阅读全文
posted @ 2020-07-30 16:04 Sexyomaru 阅读(48) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int maximumSum(int[] arr) { int n = arr.length; int[][] dp = new int[n][2]; // dp[i][0]: 以i结尾未删 dp[i][1]: 以i结尾未删过 dp[0][0] = a 阅读全文
posted @ 2020-07-30 10:58 Sexyomaru 阅读(137) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int longestOnes(int[] A, int K) { int n = A.length; int res = 0, rest = K; int l = 0, r = 0; while(r < n) { int num = A[r++]; 阅读全文
posted @ 2020-07-30 10:56 Sexyomaru 阅读(73) 评论(0) 推荐(0) 编辑