Leetcode 1586. Binary Search Tree Iterator II
Design a bidirectional in-order iterator for a binary search tree that lets you move forward and backward through the sorted elements via next()/hasNext() and prev()/hasPrev(); implement it to support efficient (amortized O(1)) operations using only O(h) extra space (h = tree height) without modifying the tree.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.