All Problems

Flatten Binary Tree to Linked List

Mediumlinked-listExpected: O(n) time, O(1) spaceInterview Context
stacklinked-listrecursion

Problem

Given the root of a binary tree, flatten the tree into a linked list in-place following pre-order traversal.

Loading...