Open wangjunstf opened 3 years ago
https://www.wangjunblogs.com/2021/09/16/hui-fu-er-cha-sou-suo-shu/
题目链接 给你二叉搜索树的根节点 root ,该树中的两个节点被错误地交换。请在不改变其结构的情况下,恢复这棵树。 进阶:使用 O(n) 空间复杂度的解法很容易实现。你能想出一个只使用常数空间的解决方案吗?
https://www.wangjunblogs.com/2021/09/16/hui-fu-er-cha-sou-suo-shu/
题目链接 给你二叉搜索树的根节点 root ,该树中的两个节点被错误地交换。请在不改变其结构的情况下,恢复这棵树。 进阶:使用 O(n) 空间复杂度的解法很容易实现。你能想出一个只使用常数空间的解决方案吗?