2018年7月19日

144. Binary Tree Preorder Traversal

摘要: Given a binary tree, return the preorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [1,2,3] Follow up: Recursive s 阅读全文

posted @ 2018-07-19 12:41 猪猪🐷 阅读(125) 评论(0) 推荐(0)

94. Binary Tree Inorder Traversal

摘要: Given a binary tree, return the inorder traversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iteratively 阅读全文

posted @ 2018-07-19 12:23 猪猪🐷 阅读(103) 评论(0) 推荐(0)

104. Maximum Depth of Binary Tree

摘要: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文

posted @ 2018-07-19 12:20 猪猪🐷 阅读(76) 评论(0) 推荐(0)

111. Minimum Depth of Binary Tree

摘要: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文

posted @ 2018-07-19 12:19 猪猪🐷 阅读(90) 评论(0) 推荐(0)

101. Symmetric Tree

摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文

posted @ 2018-07-19 12:18 猪猪🐷 阅读(85) 评论(0) 推荐(0)

563. Binary Tree Tilt

摘要: Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subt 阅读全文

posted @ 2018-07-19 12:17 猪猪🐷 阅读(72) 评论(0) 推荐(0)

508. Most Frequent Subtree Sum

摘要: Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values 阅读全文

posted @ 2018-07-19 12:16 猪猪🐷 阅读(112) 评论(0) 推荐(0)

543. Diameter of Binary Tree

摘要: Time Complexity: O(N) We visit every node once. Space Complexity: O(N), the size of our implicit call stack during our depth-first search. Time Comple 阅读全文

posted @ 2018-07-19 12:08 猪猪🐷 阅读(71) 评论(0) 推荐(0)

100. Same Tree

摘要: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文

posted @ 2018-07-19 12:05 猪猪🐷 阅读(98) 评论(0) 推荐(0)

250. Count Univalue Subtrees (A Uni-value subtree means all nodes of the subtree have the same value.)

摘要: Given a binary tree, count the number of uni-value subtrees. A Uni-value subtree means all nodes of the subtree have the same value. Example : 阅读全文

posted @ 2018-07-19 12:05 猪猪🐷 阅读(109) 评论(0) 推荐(0)

226. Invert Binary Tree

摘要: Invert a binary tree. Example: Input: Output: 阅读全文

posted @ 2018-07-19 12:04 猪猪🐷 阅读(83) 评论(0) 推荐(0)

导航