摘要:
``` /** * 102. Binary Tree Level Order Traversal * 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> levelOrder(TreeNode root) { List> res = 阅读全文
摘要:
```/** * 145. Binary Tree Postorder Traversal * 1. Time:O(n) Space:O(n) * 2. Time:O(n) Space:O(n) * 3. Time:O(n) Space:O(n) * 4. Time:O(n) Space:O(1) */// 1. Time:O(n) Space:O(n)class Solution { ... 阅读全文
摘要:
```/** * 94. Binary Tree Inorder Traversal * 1. Time:O(n) Space:O(n) * 2. Time:O(n) Space:O(n) * 3. Time:O(n) Space:O(1) */// 1. Time:O(n) Space:O(n)class Solution { public List inorderTraversa... 阅读全文
摘要:
```/** * 144. Binary Tree Preorder Traversal * 1. Time:O(n) Space:O(n) * 2. Time:O(n) Space:O(n) * 3. Time:O(n) Space:O(n) * 4. Time:O(n) Space:O(1) */// 1. Time:O(n) Space:O(n)class Solution { ... 阅读全文
摘要:
代码 解释 public 访问修饰符,控制程序的其他部分对这段代码的访问级别 class 关键字,表示类 FirstSample 类名 Java中类名的命名规定 以字母开头,后面可以跟字母和数字的任意组合,长度基本上没有限制 类名不能是Java保留字 main方法 Java 1.4之后强制main方 阅读全文