Challenge: Tree to List Conversion using Recursion

Let’s convert a tree to a doubly linked list.

Problem

Given a binary tree, create a doubly linked list from the tree such that the elements are in the order of in-order traversal of the tree.

Input

A binary tree.

Output

The head of the doubly linked list.

Sample input

Get hands-on with 1400+ tech skills courses.