Problem 998 · Medium

Maximum Binary Tree II

Appending a value to the array behind a maximum tree: the new value either becomes the root or descends the right spine.

Open the interactive visualisation