'''

public class BSTIterator {

Queue<Integer> q;

public BSTIterator(TreeNode root) {

q = new LinkedList<>();

helper(root, q);

}

private void helper(TreeNode node, Queue<Integer> q) {

if (node==null) return;

helper(node.left, q);

q.add(node.val);

helper(node.right, q);

}

```
/** @return whether we have a next smallest number */
public boolean hasNext() {
return !q.isEmpty();
}
/** @return the next smallest number */
public int next() {
return q.poll();
}
```

}

'''