Chewbacca Number, test case 2,3,4

My solution: https://ide.codingblocks.com/s/404714

Question: https://online.codingblocks.com/app/player/178555/content/173727/4713/code-challenge

Test case 0 and 1 passed, but 2,3,4 failed - wrong answer.

The question is chewbacca and number only ? As the link you have sent to me is of your course, and I don’t have accss to your course. So just confirm the name of the problem.

@Encoder Yes, the problem’s name is ‘Chewbacca and Number’.

Okay so i got the issue in your code, what is happening is that you have taken data type as int, but in the question it’s given that x can be of size 100000000000000000 that is 10^18. so what you can do is store it in a format of an array or string and then perform operation on each indexes , cause your logic is right. It’s just the constraints.
To verify you can see for this test case:
932711047202
Expected output is: 932211042202
yours is giving: 32211042202

@Encoder. Thanks. I’ll try it out using an array.

@Encoder I have tried the array approach too. But, only one more test case(4th) got right, but wnd, 3rd are still showing wrong answers. My new solution: https://ide.codingblocks.com/s/404923

*2nd, 3rd are still showing wrong, even with the array approach. Only 0,1,4 are right

Bro you are doing it wrong again. Taking input as int data type then storing it in an array. The input you are taking is in int leading to overflow. Try to do it like this, it’s simple and easy. And the logic you have applied is absolutely right as i told it’s only an issue with the data type

@Encoder Oh! Now, I got it! Thank you man!

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.