leetcode伪代码merge-two-binary-tree
题目解读:
题目来源:
原文:
Given
two
binary
trees
and
imagine
that
when
you
put
one
of
them
to
cover
the
other,
some
nodes
of
the
two
trees
are
overlapped
while
the
others
are
not.
You
need
to
merge
them
into
a
new
binary
tree.
The
merge
rule
is
that
if
two
nodes
overlap,
then
sum
node
values
up
as
the
new
value
of
the
merged
node.
Otherwise,
the
NOT
null
node
will
be
used
as
the
node
of
new
tree
.
解读:
给定两个二元树Tree1,
Tree2
把Tree1跟Tree2
做merge
merge
规则如下:
1
假设对应的节点两个原本二元树都有值则
2023-04-12 13:10:14
4KB
系统开源
1