Problem 1660 · Medium

Correct a Binary Tree

Walk level by level; the first right pointer that lands on a node already at its depth is the defect, so detach that node.

Open the interactive visualisation