摘要:
public int longestConsecutive(int[] nums) { int result = 0; Set<Integer> set = new HashSet<>(); for(int i = 0 ; i < nums.length ; i++) { set.add(nums[ 阅读全文
摘要:
public List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> result = new ArrayList<>(); if(nums.length < 3)return result; Arrays.sort(nums); 阅读全文
摘要:
示例代码: public static void main(String[] args) { int b = 0; change(b); System.out.println(b); } public static void change(int a) { a = 1; } 结果: 为什么b的值不会 阅读全文
摘要:
思路一:从中心开始扩展,分两种情况判断 public int maxLength = 1; public int start = 0; public String longestPalindrome(String s) { if(null == s || s.length() == 0) { ret 阅读全文
摘要:
1:查看nohup.out文件 发现这个值太大了。 2:修改runserver.sh和runbroker.sh文件 runserver.sh runbroker.sh 阅读全文
摘要:
public TreeNode buildTree(int[] preorder, int[] inorder) { return helper(preorder,inorder,0,preorder.length-1,0,inorder.length-1); } public TreeNode h 阅读全文
摘要:
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 阅读全文
摘要:
class Solution { public List<Integer> topKFrequent(int[] nums, int k) { //先统计每个数字出现的频率 Map<Integer,Integer> map = new HashMap<>(); for(int i = 0; i < 阅读全文
摘要:
拓扑排序 class Solution { public int[] findOrder(int numCourses, int[][] prerequisites) { //统计所有节点的入度 int[] res = new int[numCourses]; int[] in = new int[ 阅读全文
摘要:
public int[][] merge(int[][] arr) { //根据第一个元素排序,快速排序 if(arr.length == 0) return new int[0][0]; if(arr.length == 1) return arr; boolean[] isvristed = n 阅读全文