上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 25 下一页
  2022年3月21日
摘要: package leetcode; import java.util.HashMap; public class offer_07 { public TreeNode buildTree(int[] preorder, int[] inorder) { HashMap<Integer, Intege 阅读全文
posted @ 2022-03-21 15:31 一仟零一夜丶 阅读(20) 评论(0) 推荐(0)
  2022年3月20日
摘要: package leetcode; import java.util.ArrayList; import java.util.List; public class offer_68_2 { //判断是否找出p和q boolean flag1=false; boolean flag2=false; p 阅读全文
posted @ 2022-03-20 16:30 一仟零一夜丶 阅读(31) 评论(0) 推荐(0)
摘要: package leetcode; public class offer_68_1 { public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { TreeNode node=root; while(tr 阅读全文
posted @ 2022-03-20 14:31 一仟零一夜丶 阅读(13) 评论(0) 推荐(0)
摘要: package leetcode; public class offer_64 { public int sumNums(int n) { //&&预算符左边为false,则不会判断右边直接返回false boolean flag=n>0&&(n=n+sumNums(n-1))>0; return 阅读全文
posted @ 2022-03-20 14:10 一仟零一夜丶 阅读(25) 评论(0) 推荐(0)
  2022年3月19日
摘要: package leetcode; public class offer_55_2 { public boolean isBalanced(TreeNode root) { if(root==null) { return true; } return isBalanced(root.left)&&i 阅读全文
posted @ 2022-03-19 11:19 一仟零一夜丶 阅读(14) 评论(0) 推荐(0)
摘要: class Solution { public int maxDepth(TreeNode root) { return root==null?0:Math.max(maxDepth(root.left),maxDepth(root.right))+1; } } 阅读全文
posted @ 2022-03-19 10:36 一仟零一夜丶 阅读(20) 评论(0) 推荐(0)
摘要: package leetcode; public class offer_55_1 { int count=0; int maxlength=0; public int maxDepth(TreeNode root) { backtrace(root); return maxlength; } pu 阅读全文
posted @ 2022-03-19 10:33 一仟零一夜丶 阅读(18) 评论(0) 推荐(0)
  2022年3月18日
摘要: package leetcode; import java.util.Comparator; import java.util.PriorityQueue; public class offer_41 { private PriorityQueue<Integer> big; private Pri 阅读全文
posted @ 2022-03-18 11:06 一仟零一夜丶 阅读(18) 评论(0) 推荐(0)
摘要: package leetcode; import java.util.Comparator; import java.util.PriorityQueue; public class offer_40 { public int[] getLeastNumbers(int[] arr, int k) 阅读全文
posted @ 2022-03-18 10:33 一仟零一夜丶 阅读(26) 评论(0) 推荐(0)
  2022年3月17日
摘要: package leetcode; import java.util.Arrays; import java.util.Comparator; public class offer_45 { public String minNumber(int[] nums) { String[] str=new 阅读全文
posted @ 2022-03-17 16:46 一仟零一夜丶 阅读(21) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 25 下一页