This problem should add "in only one traversal"

  • 1

    Like, give you an API to get the next element. This make sense because sometimes doing the traversal is very slow, say the elements are not in memory and you have to use some slow method to get the next one. So we can not simply count and rand.

Log in to reply

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