In the solution shown, can you please explain why an array of size 9 was created ans starting point as j+1 ?
Doubt in the code logic
hello @PThak2018

9-10 digits are sufficient to store 32 bit number.
we are decrementing j after processing each digit. so when we process the last digit(right most) then also we will decrement j .
thats why we are adding 1 to j , to get starting point
What if take a number of 10 digits. Then how would we store the first digit in our array?
use 10 size array. . . . . . . . . .
yup, so ideally we should be taking an array of 10 size only.
That was the doubt why 9 only?
may be instructor did it by mistake. . . . . . . …
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.