摘要: public int longestConsecutive(int[] nums) { int result = 0; Set<Integer> set = new HashSet<>(); for(int i = 0 ; i < nums.length ; i++) { set.add(nums[ 阅读全文
posted @ 2020-07-07 10:46 贼心~不死 阅读(101) 评论(0) 推荐(0) 编辑
摘要: public List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> result = new ArrayList<>(); if(nums.length < 3)return result; Arrays.sort(nums); 阅读全文
posted @ 2020-07-04 20:55 贼心~不死 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 示例代码: public static void main(String[] args) { int b = 0; change(b); System.out.println(b); } public static void change(int a) { a = 1; } 结果: 为什么b的值不会 阅读全文
posted @ 2020-07-03 22:44 贼心~不死 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 思路一:从中心开始扩展,分两种情况判断 public int maxLength = 1; public int start = 0; public String longestPalindrome(String s) { if(null == s || s.length() == 0) { ret 阅读全文
posted @ 2020-07-03 21:26 贼心~不死 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1:查看nohup.out文件 发现这个值太大了。 2:修改runserver.sh和runbroker.sh文件 runserver.sh runbroker.sh 阅读全文
posted @ 2020-06-24 10:01 贼心~不死 阅读(1209) 评论(0) 推荐(0) 编辑
摘要: public TreeNode buildTree(int[] preorder, int[] inorder) { return helper(preorder,inorder,0,preorder.length-1,0,inorder.length-1); } public TreeNode h 阅读全文
posted @ 2020-06-16 21:29 贼心~不死 阅读(166) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int[] maxSlidingWindow(int[] nums, int k) { //双指针滑窗 int l = nums.length; if( l == 0)return nums; int[] res = new int[l - k + 1 阅读全文
posted @ 2020-05-14 07:40 贼心~不死 阅读(136) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List<Integer> topKFrequent(int[] nums, int k) { //先统计每个数字出现的频率 Map<Integer,Integer> map = new HashMap<>(); for(int i = 0; i < 阅读全文
posted @ 2020-05-12 20:37 贼心~不死 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 拓扑排序 class Solution { public int[] findOrder(int numCourses, int[][] prerequisites) { //统计所有节点的入度 int[] res = new int[numCourses]; int[] in = new int[ 阅读全文
posted @ 2020-05-11 20:26 贼心~不死 阅读(121) 评论(0) 推荐(0) 编辑
摘要: public int[][] merge(int[][] arr) { //根据第一个元素排序,快速排序 if(arr.length == 0) return new int[0][0]; if(arr.length == 1) return arr; boolean[] isvristed = n 阅读全文
posted @ 2020-05-10 21:32 贼心~不死 阅读(127) 评论(0) 推荐(0) 编辑