摘要:
438.找到字符串中所有的字母异位词 思路:固定窗口 点击查看代码 class Solution { public List<Integer> findAnagrams(String s, String p) { List<Integer> result = new ArrayList<>(); i 阅读全文
摘要:
209. 长度最小的子数组 点击查看代码 class Solution { public int minSubArrayLen(int target, int[] nums) { int n = nums.length; int res = Integer.MAX_VALUE; int sum = 阅读全文
摘要:
盛最多水的容器 点击查看代码 class Solution { public int maxArea(int[] height) { int n = height.length; int l = 0; int r = n - 1; int res = Integer.MIN_VALUE; while 阅读全文
摘要:
四数之和 点击查看代码 class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { int n = nums.length; Arrays.sort(nums); List<List<Integer>> 阅读全文
摘要:
三数之和 点击查看代码 class Solution { public List<List<Integer>> threeSum(int[] nums) { Arrays.sort(nums); int n = nums.length; List<List<Integer>> res = new A 阅读全文
摘要:
点击查看代码 //闭合区间二分查找 public int Binary_Search_1(int[] num, int target){ int left = 0; int right = num.length - 1; while(left <= right){ int mid = left + 阅读全文