02 2022 档案

摘要:1.JZ33 二叉搜索树的后序遍历序列 public boolean VerifySquenceOfBST(int [] sequence) { if(sequence == null || sequence.length == 0) { return false; } return process 阅读全文
posted @ 2022-02-28 15:09 现在开始努力 阅读(31) 评论(0) 推荐(0)
摘要:1.JZ23 链表中环的入口结点 public ListNode EntryNodeOfLoop(ListNode pHead) { if(pHead == null || pHead.next == null || pHead.next.next == null) { return null; } 阅读全文
posted @ 2022-02-25 11:56 现在开始努力 阅读(33) 评论(0) 推荐(0)
摘要:1.JZ13 机器人的运动范围 int ans = 0; public int movingCount(int threshold, int rows, int cols) { boolean dp[][] = new boolean[rows][cols]; process(dp,threshol 阅读全文
posted @ 2022-02-24 11:00 现在开始努力 阅读(60) 评论(0) 推荐(0)
摘要:1.JZ3 数组中重复的数字 public int duplicate (int[] numbers) { int L = 0; while(L < numbers.length) { if(numbers[L] == L) { L ++; }else if(numbers[numbers[L]] 阅读全文
posted @ 2022-02-23 17:07 现在开始努力 阅读(49) 评论(0) 推荐(0)
摘要:148.排序链表 public ListNode sortList(ListNode head) { ListNode cur = head; int length = 0; while(cur != null) { cur = cur.next; length ++; } ListNode h = 阅读全文
posted @ 2022-02-18 15:54 现在开始努力 阅读(51) 评论(0) 推荐(0)
摘要:136.只出现一次的数字 public int singleNumber(int[] nums) { int ans = 0; for(int i : nums) { ans ^= i; } return ans; } 138.复制带随机指针的链表 public Node copyRandomLis 阅读全文
posted @ 2022-02-17 15:36 现在开始努力 阅读(36) 评论(0) 推荐(0)
摘要:128.最长连续序列 public int longestConsecutive(int[] nums) { int len = 0; HashMap<Integer,Integer> hm = new HashMap<>(); for(int i : nums) { if(!hm.contains 阅读全文
posted @ 2022-02-16 15:29 现在开始努力 阅读(33) 评论(0) 推荐(0)
摘要:124.二叉树的最大路径和 public int maxPathSum(TreeNode root) { if(root == null) { return 0; } return process(root).max; } public Info process(TreeNode root) { i 阅读全文
posted @ 2022-02-15 16:34 现在开始努力 阅读(37) 评论(0) 推荐(0)
摘要:188.买卖股票的最佳时机4 public int maxProfit(int k, int[] prices) { if (prices == null || prices.length == 0) { return 0; } int N = prices.length; if (k >= N / 阅读全文
posted @ 2022-02-14 17:07 现在开始努力 阅读(53) 评论(0) 推荐(0)
摘要:116.填充每个节点的下一个右侧节点 public Node connect(Node root) { if(root == null) { return null; } MyQueue myQueue = new MyQueue(); myQueue.add(root); while(!myQue 阅读全文
posted @ 2022-02-11 16:54 现在开始努力 阅读(45) 评论(0) 推荐(0)