Chewbacca and Number
@LPU11910344
It is given that “The decimal representation of the final number shouldn’t start with a zero.”
Consider a case:
999000
Expected o/p
900000
Your o/p
000000
Also check the constraints…Constraints
x <= 100000000000000000
But the maximum size int array you can make is upto 10^5…So do not take the input in an integer array. You can you long long int datatype to handle large number
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.
but if we take input 999000 how can we get 900000 ?
@LPU11910344
You’ve to put the condition that, when there’s 9 at the first digit, you don’t have to change it. Coz that’s the only way you can avoid the zero in the first digit
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.