Problem of the Day
A new programming or logic puzzle every Mon-Fri

Flatten Tree

Today's goal is to take in a binary tree and flatten it into a linked list as shown below. Can you solved this in place (without creating a new linked list)?

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

Permalink: http://problemotd.com/problem/flatten-tree/

Comments:

  • There are currently no comments. You can be first!

Content curated by @MaxBurstein