Problem 971 · Medium

Flip Binary Tree To Match Preorder Traversal

Walk the tree in preorder, flipping a node whenever its left child is not the next voyage value.

Open the interactive visualisation