Java | Leetcode Java题解之第173题二叉搜索树迭代器
题目: 题解: class BSTIterator {private TreeNode cur;private Deque<TreeNode> stack;public BSTIterator(TreeNode root) {cur root;stack new LinkedList<TreeNode>();}public int next() {while (cur ! null) {stack.push(cur);cur …
2024-12-09