Final formula = 9∗pow(10,n/2-1)
10^N -1 means 9999…N times.
We need A + rev(A) = 10^N -1.
So, if first digit of A is x, last digit will be 9-x, and same goes for second and second last and so on.
This means If N%2 != 0, ans is 0, as middle digit of odd length number will be the same, say x, but 2x != 9 in any case, so ans = 0.
First 9 is there because we cannot have leading zeroes, therefor 9 choices for first digit.
For remaining, we see that we can select any of the 10 digit for N/2 -1 places (rest will be determined by taking 9-corresponding digit from left side).
So, N/2-1 times 10 choices * 9 choicea for first digit gives 9*10^(N/2-1).
Friend, whenever asking regarding a problem, do include problem name in question heading.
great @taran_1407 thanks.
I think that since you help at least no laddu then also something like certificate or anything should be given to you contributors
No problem friend…