Skip to content

Files

tree-to-linked-list

Given a binary tree, write a function to convert it into a circular doubly linked list from left to right by only modifying the existing pointers.

Sample Input

tree =    1
       /     \
      2       3
    /   \   /   \
   4     5 6     7   

Sample Output

4 2 5 1 6 3 7