Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- vector<int> ans;
- void dfs(int n,int original,int power){
- if(original<n){
- return;
- }
- for(int i=1;i<10;i++){
- ans.push_back(n);
- dfs(i*pow(10,power)+n,original,power+1);
- }
- return;
- }
- vector<int> lexicalOrder(int n) {
- dfs(0,n,0);
- return ans;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement