摘要:
class MaxQueue { Queue<Integer> queue; Deque<Integer> deque; public MaxQueue() { queue = new LinkedList<>(); deque = new LinkedList<>(); } public int 阅读全文
摘要:
class Solution { public int[] maxInWindows(int[] nums, int k) { if(nums == null || nums.length == 0) return new int[0]; int[] res = new int[nums.lengt 阅读全文
摘要:
拆解步骤来做 class Solution { public String reverseLeftWords(String s, int n) { return s.substring(n,s.length()) + s.substring(0,n); } } 阅读全文
摘要:
1、整个字符串反转 2、每个单词反转 the sky is blue ==> eulb si yks eht ==> blue is sky the ok 思路2 利用API,从后到前拼接String class Solution { public String reverseWords(Strin 阅读全文
摘要:
class Solution { public int[][] findContinuousSequence(int target) { List<List<Integer>> list = new ArrayList<>(); List<Integer> res = new ArrayList<> 阅读全文
摘要:
class Solution { public int[] twoSum(int[] nums, int target) { int i = 0; int j = nums.length - 1; while(i < j){ int s = nums[i] + nums[j]; if(s < tar 阅读全文
摘要:
class Solution { public int[] singleNumbers(int[] nums) { int xy = 0; for(int num: nums){ xy ^= num; } int k = 0; while((xy >> k & 1) == 0){ k++; } in 阅读全文
摘要:
利用上一题求深度的做法 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = 阅读全文
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ 阅读全文
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ 阅读全文