What does the next smallest mean?


  • 0
    Z

    Could someone please explain what does next smallest mean? Thanks!!
    In the test case, it has input: {1,#,2}. My output is [1], but it's expecting [1,2]


  • 2
    M

    The OJ calls your next() while hasNext() returns true so it should output the elements in order from smallest to largest, not just the first one.


  • 0
    G

    I also has the same confusion. If the iterator is initialized to root node, then next smallest element should be the the smallest element of its right child.
    For example, if given {1,#, 2}, then the next smallest element should be 2, correct?

    Thanks


Log in to reply
 

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