Clarified Meaning for Next Smallest


  • 3

    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


  • 0
    H

    yeah it wasnt exactly clear to me... i read it as 'next smaller' starting from the root going down. but when i saw the solution it seemed a bit more obvious how to do it


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.