How to think it in the DFS way

  • 2


    we can imagine such a tree, out task is to traversal it with DFS, and collect numbers along the way: 1, 10, 100, ... you get it. When we encounter a number larger than n, we can return back to the previous level.

    Hope it helps

  • 0

    very helpful!!

Log in to reply

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