摘要: ```/** * 173. Binary Search Tree Iterator * 1. Time:O() Space:O() * 2. Time:O() Space:O() */// 1. Time:O() Space:O()class BSTIterator { ArrayList res; int index; public BSTIterator(Tre... 阅读全文
posted @ 2020-04-28 13:58 AAAmsl 阅读(66) 评论(0) 推荐(0) 编辑
摘要: ```/** * 226. Invert Binary Tree * 1. Time:O(n) Space:O(n) * 2. Time:O(n) Space:O(n) */// 1. Time:O(n) Space:O(n)class Solution { public TreeNode invertTree(TreeNode root) { if(root==null... 阅读全文
posted @ 2020-04-28 13:57 AAAmsl 阅读(65) 评论(0) 推荐(0) 编辑
摘要: ``` /** * 199. Binary Tree Right Side View * 1. Time:O(n) Space:O(n) * 2. Time:O(n) Space:O(n) */ // 1. Time:O(n) Space:O(n) class Solution { public List rightSideView(TreeNode root) { List res = new 阅读全文
posted @ 2020-04-28 13:56 AAAmsl 阅读(70) 评论(0) 推荐(0) 编辑
摘要: ```/** * 107. Binary Tree Level Order Traversal II * 1. Time:O(n) Space:O(n) * 2. Time:O(n) Space:O(n) */// 1. Time:O(n) Space:O(n)class Solution { public List> levelOrderBottom(TreeNode root) {... 阅读全文
posted @ 2020-04-28 13:54 AAAmsl 阅读(64) 评论(0) 推荐(0) 编辑