摘要:
15 给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满足条件且不重复的三元组。注意:答案中不可以包含重复的三元组。 class Solution { public List<List<Integer>> thr 阅读全文
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ 阅读全文
摘要:
package heap;public class IndexMaxHeap { private int[] data; private int count; private int capacity; private int[] indexes; public IndexMaxHeap(int c 阅读全文
摘要:
class Solution { public int search(int[] nums, int target) { int l=0; int r=nums.length-1; while(l<=r) { int mid=l+(r-l)/2; if(nums[mid]==target) retu 阅读全文
摘要:
public class MaxHeap { private int[] data; private int count; private int capacity; public MaxHeap(int capacity){ this.capacity=capacity; data=new int 阅读全文
摘要:
//利用归并排序来完成,归并排序可参考前面代码,归并排序可用来完成这类逆序对之类的问题,采用分治的思想,对于归并排序的代码不需要多改动,只需要在归并之前进行一次寻找操作,找出count的数量 class Solution { private int count=0; public int rever 阅读全文