I want to solve an algorithm in which I have this input :
n = 30 and st = 1234321
Now i want to see how many combination's can be formed using the string i.e. it can have
(1 2 3 4 2 1)
(1 23 4 3 2 1)
(1 2 3 4 3 21)
(12 3 4 3 2 1)
(12 3 4 3 21)
(1 23 4 3 21)
i.e. all less than 30. So total combinations will be 6.
But we dicard the string in counts when we have either 0 present alone or as in leading like 09.
take the case: n = 70 and st = 8675309. Now in this case we have:
(8 6 7 5 3 0 9)
(8 67 5 3 0 9)
(8 6 7 53 0 9)
(8 6 7 5 30 9)
(8 6 7 5 3 09)
(8 67 53 0 9)
(8 67 5 30 9)
(8 67 5 3 09)
here count total is 2 only as (we don't count if we have either 0 present alone or as in leading like 09).
Please suggest me c# code for to find such combinations.