Flatten Binary Tree to Linked List - Coddicted

Flatten Binary Tree to Linked List

Title: Flatten Binary Tree to Linked List Source: leetcode.com

Given a binary tree, flatten it to a linked list in-place.

For example,
Given

Hints:

If you notice carefully in the flattened tree, each node’s right child points to the next node of a pre-order traversal.

Python solution


Back To Top
Rate this post

Leave a Reply