#3 most askedVery commonEasyTree DFS
Same Tree
New to Tree DFS? Learn it from scratch firstTrees & Binary Search Trees โ
๐ข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.Return True if two binary trees have the same shape and the same values.
๐งช Practice
Write your solution, then press Run tests. Explain your approach out loud as you go.
def is_same_tree(p, q):
pass
Output appears here. Press Run or Ctrl/โ + Enter.
Try it first. Struggling for a few minutes is how it sticks.