Skip to content

Commit

Permalink
100
Browse files Browse the repository at this point in the history
  • Loading branch information
TedTran2019 committed Jul 8, 2022
1 parent 63d3ece commit c2f50ab
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ruby/100-Same-Tree.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def is_same_tree(p, q)
if p.nil? && q.nil?
true
elsif p && q
(p.val == q.val) &&
is_same_tree(p.left, q.left) &&
is_same_tree(p.right, q.right)
else
false
end
end

0 comments on commit c2f50ab

Please sign in to comment.