515. Find Largest Value in Each Tree Row
1 | class Solution { |
就是pre-order traversal, 和level order traversal的思路一样.
时间复杂度: O(n)
空间复杂度: O(n) 用来存答案的list以及递归需要用到栈桢.
Insist on doing small things, then witness the magic
1 | class Solution { |
就是pre-order traversal, 和level order traversal的思路一样.
时间复杂度: O(n)
空间复杂度: O(n) 用来存答案的list以及递归需要用到栈桢.