The meaning of next smallest is as follows. Imagine that the input is a valid BST. Traverse the nodes in order that they would be visited in an in-order traversal. See examples below:

Ex 1:

3(root)

2(left of 3) 4(Right of 3)

-next should return the nodes in the following order: 2, 3, 4

Ex 2:

3(root)

null(left of 3) 4(right of 3)

-next should return the nodes in the following order: 3, 4