摘要:
盛最多水的容器 点击查看代码 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 + 阅读全文
摘要:
105从前序和中序遍历序列构造二叉树 方法思路:hashmap存中序列表(数和序号)优化时间复杂度,先得到根节点,然后递归创建左子树和右子树。 106从后序和中序遍历序列构造二叉树 同上题 1373二叉搜索树的最大键值和 点击查看代码 class Solution { private int max 阅读全文