1586. Binary Search Tree Iterator II
StackTreeDesignBinary Search TreeBinary TreeIterator
Hints
Hint 1
The inorder traversal of a BST gives us the elements in a sorted order.
Hint 2
We can use a stack to simulate the inorder traversal of the BST.
Hint 3
We can use another stack as a buffer to store numbers returned from calls to next and use this buffer whenever prev is called.
Preparing judge…