上一页 1 2 3 4 5 6 7 8 ··· 33 下一页
摘要: public int[] constructArr(int[] a) { int len = a.length; if(len == 0) return new int[0]; int[] b = new int[len]; return multiply(a,b,len); } private i 阅读全文
posted @ 2020-08-22 09:59 欣姐姐 阅读(85) 评论(0) 推荐(0) 编辑
摘要: public int add(int a, int b) { int sum ,carry; do{ sum = a^b; carry = (a&b)<<1; a = sum; b = carry; }while(carry!=0); return a; } 阅读全文
posted @ 2020-08-22 09:40 欣姐姐 阅读(67) 评论(0) 推荐(0) 编辑
摘要: public int lastRemaining(int n, int m) { ArrayList<Integer> list = new ArrayList<>(n); for (int i = 0; i < n; i++) { list.add(i); } int idx = 0; while 阅读全文
posted @ 2020-08-22 09:29 欣姐姐 阅读(107) 评论(0) 推荐(0) 编辑
摘要: class Solution { public boolean isStraight(int[] nums) { Arrays.sort(nums); int i = 3; if(nums[4]<3) return false; while(i>=0){ if(nums[i] == nums[i+1 阅读全文
posted @ 2020-08-21 20:41 欣姐姐 阅读(144) 评论(0) 推荐(0) 编辑
摘要: public int[] maxSlidingWindow(int[] nums, int k) { int len = nums.length; if(len == 0 ) return new int[0]; int[] res = new int[len-k+1]; int max = num 阅读全文
posted @ 2020-08-21 20:37 欣姐姐 阅读(196) 评论(0) 推荐(0) 编辑
摘要: public String reverseLeftWords(String s, int n) { int len = s.length(); n = n%len; String sub_str1 = s.substring(0,n); String sub_str2 = s.substring(n 阅读全文
posted @ 2020-08-21 17:44 欣姐姐 阅读(70) 评论(0) 推荐(0) 编辑
摘要: class Solution { public String reverseWords(String s) { s = s.trim(); String[] str = s.split(" "); StringBuilder sb = new StringBuilder(); int len = s 阅读全文
posted @ 2020-08-21 17:40 欣姐姐 阅读(76) 评论(0) 推荐(0) 编辑
摘要: List<List<Integer>> res = new ArrayList<>(); public int[][] findContinuousSequence(int target) { List<Integer> list = new ArrayList<>(); findOne(targe 阅读全文
posted @ 2020-08-21 17:31 欣姐姐 阅读(116) 评论(0) 推荐(0) 编辑
摘要: public int[] twoSum(int[] nums, int target) { int len = nums.length; if(len==1) if(target == nums[0]) return nums; else return new int[0]; int i = 0,j 阅读全文
posted @ 2020-08-21 16:27 欣姐姐 阅读(99) 评论(0) 推荐(0) 编辑
摘要: public int maxDepth(TreeNode root) { if(root == null) return 0; return 1+Math.max(maxDepth(root.left),maxDepth(root.right)); } 阅读全文
posted @ 2020-08-21 16:20 欣姐姐 阅读(76) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 33 下一页