Home > Back-end >  algorithm
algorithm

Time:09-22

Given a number n, such as 23121; Given A set of Numbers as A,4,9 {2}, and composed of elements in A less than the maximum number of n, such as less than the maximum number of 23121 to 22999
DFS (was going to use to do but stuck to seek you dalao solution)

CodePudding user response:

It is relatively simple?
1. The first n you points out,
2. Given a set of digital smallest
3. The n digits compared to a set of Numbers (key), set a flag lessThan=0;
If you can find the same, with equal,
If it is the last one, find the equal with equal after a
If you cannot find quite etc, there is little, lessThan=1;
All the rest of the biggest inside with a given number of,

CodePudding user response:

CodePudding user response:

refer to the second floor wsshow response:

Number is not necessarily the same

CodePudding user response:

references simple reply: 3/f
Quote: refer to the second floor wsshow response:


Number is not necessarily the same


I did not consider that leave it to the original poster optimization

CodePudding user response:

Less than the maximum number of n, which is less than or equal to the maximum number of n - 1

CodePudding user response: