A8df6fbecf5e6c934459877a1a28c435
(难度Medium) Problem 114. Flatten Binary Tree to Linked List(二叉树转链表)

Flatten Binary Tree to Linked List

Difficulty

Medium

Description

Given a binary tree, flatten it to a linked list in-place.

For example, given the following tree:

    1
   / \
  2   5
 / \   \
3   4   6

The flattened tree should look like:

1
 \
  2
   \
    3
     \
      4
       \
        5
         \
          6

题意

给定一棵二叉树,要求将它拉成链表的形状,可以参考样例。

题解

刚拿到题目的时候是懵逼的,怎么会有这么神奇的题目。

top Created with Sketch.