摘要:
662. 二叉树最大宽度(优化解法,防止正常标记的id数超过int范围(全是右子树)) List<Integer> ls = new ArrayList<>(); // 记录每一层的最左节点初始id public int widthOfBinaryTree(TreeNode root) { retu 阅读全文
摘要:
1.JZ13 机器人的运动范围 int ans = 0; public int movingCount(int threshold, int rows, int cols) { boolean dp[][] = new boolean[rows][cols]; process(dp,threshol 阅读全文
摘要:
136.只出现一次的数字 public int singleNumber(int[] nums) { int ans = 0; for(int i : nums) { ans ^= i; } return ans; } 138.复制带随机指针的链表 public Node copyRandomLis 阅读全文
摘要:
128.最长连续序列 public int longestConsecutive(int[] nums) { int len = 0; HashMap<Integer,Integer> hm = new HashMap<>(); for(int i : nums) { if(!hm.contains 阅读全文