← ALL NOTES
Tree

99. Recover Binary Search Tree

The key fact: an in-order traversal of a valid BST is strictly increasing, and swapping two nodes' values leaves exactly one or two inversions (spots where the previous value exceeds the current).…

Loading…