114. Flatten Binary Tree to Linked List
# Medium
很有意思的一道题,思路其实不难,主要是recursive的思想,跟Tree没有太大关系。
Solution:
transform
root.right
totemp
.flat
root.left
then transferroot.right
.assign
root
toroot2
, letroot2
goes to the bottom of the tree.link
root2
withflat(temp)
.return
root
.stop condition:
if root = NULL
, return imediately.
Last updated