Leetcode 1660. Correct a Binary Tree
A binary tree has exactly one child pointer that incorrectly points to another existing node, creating a node with two parents (or a cycle); locate and remove that wrong pointer to restore a valid tree. Solve by traversing the structure (BFS/DFS) while tracking seen nodes to detect the offending edge and set it to null.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Your account is free and you can post anonymously if you choose.