Search
⌘K
Get Premium
Leetcode 173. Binary Search Tree Iterator
Implement an iterator over a BST that returns elements in in-order (ascending) via next() and hasNext(), starting before the smallest element so the first next() yields the minimum. Aim for next()/hasNext() to handle up to 1e5 calls with amortized O(1) time and O(h) extra space (h = tree height).
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Early December, 2025
Meta
Senior
You have a binary tree, you need to implement a iterator which returns a single element, traversing tree in in-order. https://leetcode.com/problems/binary-search-tree-iterator
Early October, 2025
Meta
Mid-level
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.