FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

package LeetCode; public class LeetCode209 { // https://leetcode.com/problems/minimum-size-subarray-sum/description/ // 暴力解法 // 该方法在 Leetcode 中会超时! // 时间复杂度: O(n^3) // 空间复杂度: O(1) public int minSubArrayLen(int s, int[] nums) { if (s = s){ sum -= nums[l++]; if(sum >= s) res = Math.min(res, r - l + 1); } } if(res == nums.length + 1) return 0; return res; } // 时间复杂度: O(nlogn) // 空间复杂度: O(n) // 二分搜索 public int minSubArrayLen5(int s, int[] nums) { if(s

Back | FazBrowse Home | New Git URL