wangjunstf / wangjunstf.github.io

我的博客。
https://wangjunstf.github.io/
0 stars 0 forks source link

恢复二叉搜索树 | 编程之禅 #18

Open wangjunstf opened 3 years ago

wangjunstf commented 3 years ago

https://www.wangjunblogs.com/2021/09/16/hui-fu-er-cha-sou-suo-shu/

题目链接 给你二叉搜索树的根节点 root ,该树中的两个节点被错误地交换。请在不改变其结构的情况下,恢复这棵树。 进阶:使用 O(n) 空间复杂度的解法很容易实现。你能想出一个只使用常数空间的解决方案吗?