Search⌘ K
AI Features

Flatten Binary Tree to Linked List

Understand how to transform a binary tree into a linked list following preorder traversal. Learn to use depth-first search to rearrange nodes so each left pointer is null and right pointers sequence the list.

Statement

Given the root of a binary tree, the task is to flatten the tree into a linked list using the same TreeNode class. The left ...