# 小总结

### 1. ArrayList相关用法

ArrayList就是动态数组，实现了大小可变的数组。

③void clear()

④Object clone()

⑤boolean contains(Object o)

⑥ E get(int index)

⑦ int indexOf(Object o)

⑧boolean isEmpty()

⑨E remove(int index)

10. boolean remove(Object o)

11. protected void removeRange(int fromIndex, int toIndex)

12. E set(int index, E element)

13. int size()

生成空的链表
2. getFirst() 获取链表的第一个元素getLast()获取链表的最好一个元素
3. subList(index1,index2) 从链表生成子表
7. remove(),removeLast(),removeFirst() 删除元素
9. peek()返回队列首部元素
10. poll() 取出队首元素

### 例子

**问题： **Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ \
9 20
/ \
15 7
return its bottom-up level order traversal as:
[
[15,7],
[9,20],
[3]
]

 /**
* Definition for a binary tree node.
* public class TreeNode {
*     int val;
*     TreeNode left;
*     TreeNode right;
*     TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public List<List<Integer>> levelOrderBottom(TreeNode root) {
List<List<Integer>> result = new ArrayList<List<Integer>>();
for(int i = 0, j = result.size() - 1; i < j; i++) {
return result;

}
public static List<List<Integer>> addlevel(TreeNode root, int level, List<List<Integer>> result){
if (root == null) return result;
if (result.size() == level){
}
return result;
}

}

public List<List<Integer>> levelOrderBottom(TreeNode root) {
List<List<Integer>> result = new ArrayList<List<Integer>>();
if(root==null) return result;
while(q.size()>0){
List<Integer> list = new ArrayList<>();
int size = q.size();
for(int i=0; i<size; i++){
TreeNode node = q.poll();
}