随笔分类 - 每日一刷
算法刷题,主要是java,一部分c++,c
摘要:public void rotate(int[] nums, int k) { int n = nums.length; int [] tmp = new int [k]; int j=0; int i =0; k...
阅读全文
摘要:public class Solution { public boolean isHappy(int n) { Set set = new HashSet(); while(n != 1 && !set.contains(n)){ set.add(n); i...
阅读全文
摘要:Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired bythis...
阅读全文
摘要:这个鸟玩意用了迭代,其实不太好浪费空间,数据多了还容易死,有人用stack还没研究 昨天代码有错误,num在运算后没有清零,有几个标点错误,在程序中红体,但是昨天date去了这个还是没有测,我肉眼debug的这个是600mm的还没看明白https://leetcode.com/discuss/394...
阅读全文
摘要:Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner as shown ...
阅读全文
摘要:public class Solution { public int singleNumber(int[] nums) { int ret = nums[0]; for (int i = 1; i < nums.length; i++) { ret ^= nums[i]; ...
阅读全文
摘要:public class Solution { public String addBinary(String a, String b) { int i = a.length()-1; int j = b.length()-1; int n = j>i?j:i; int su...
阅读全文
浙公网安备 33010602011771号