摘要:
https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/discuss/35476/Share-my-JAVA-solution-1ms-very-short-and-concise. 阅读全文
摘要:
1 class Solution { 2 public TreeNode sortedArrayToBST(int[] nums) { 3 int size = nums.length; 4 return helper(nums, 0, size - 1); 5 6 } 7 8 public Tr... 阅读全文
摘要:
1 class Solution { 2 public List> levelOrderBottom(TreeNode root) { 3 Queue queue = new LinkedList(); 4 List> res = new ArrayList(); 5 if(root == null) return res; 6... 阅读全文
摘要:
1 class Solution { 2 public TreeNode buildTree(int[] inorder, int[] postorder) { 3 return helper(postorder.length-1, 0, inorder.length - 1, inorder, postorder); 4 5 } 6... 阅读全文
摘要:
1 //New 用一个记录queue.size()就可以 2 class Solution { 3 public List> zigzagLevelOrder(TreeNode root) { 4 List> res = new ArrayList(); 5 if(root == null) return res; 6 Queu... 阅读全文
摘要:
https://leetcode.com/problems/symmetric-tree/discuss/166375/Java-Accepted-very-simple-solution 阅读全文