Pheonix-001 / Hacktoberfest_2022

Contribute here to take part in hacktoberfest 2022
https://hacktoberfest.com/
6 stars 36 forks source link

Flatten Binary Tree to Linked List #6

Closed palprashant2002 closed 1 year ago

palprashant2002 commented 1 year ago

Given the root of a binary tree, flatten the tree into a "linked list":

-The "linked list" should use the same TreeNode class where the right child pointer points to the next node in the list and the left child pointer is always null. -The "linked list" should be in the same order as a pre-order traversal of the binary tree.