> For the complete documentation index, see [llms.txt](https://llssff.gitbook.io/coding-problems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://llssff.gitbook.io/coding-problems/tree-traversal/flatten-binary-tree-to-linked-list.md).

# Flatten Binary Tree to Linked List

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

For example,\
Given

```
         1
        / \
       2   5
      / \   \
     3   4   6
```

The flattened tree should look like:<br>

```
   1
    \
     2
      \
       3
        \
         4
          \
           5
            \
             6
```
