100. Same Tree

dfs

time: O(n)

space: O(h), worst O(n)

iteration

time: O(n)

space: O(n), max(p, q) the number of nodes

Last updated