Why is this giving error?


And Please tell me how can I restrict to the n digit number(n<18).

HI @cbcao263 , you don;t have to restrict the number explicitily as constraints gives us the idea on how large the values can be so accordingly we can devise the algorithm . now coming to your implementation you are taking input as integer array so for input like say, 441 it will store it in arr[0] but won;t take any input for another values for array . i would recommend to take input as long long .

refer this : https://ide.codingblocks.com/s/213864
you will get the idea on how to take the input

In case of any doubt feel free to ask :slight_smile:
if you got the answer then mark your doubt as resolved

1 Like

Thanks a lot Sir.
Awesome Explanation.

great !! if u need any other help feel free to ask :slight_smile:
also mark your doubt as resolved if no further issue

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.