Time complexity of DFS approach


#1

Can anyone explain how to calculate time complexity of the DFS approach?


#2

I think BFS would be better here since we need numbers to be sorted finally!
However sort after DFS also works.

Also at max in worst case 10*(2^9) numbers ( or order of) are possible so generating all of them wont be that time consuming!Worst case time complexity could be (O(10*2^(n-1))), where n decimal digits are there in representation of m.