Chewbacca and Number

Only one test case was not passes. What’s the error in my code?

Link: https://ide.codingblocks.com/s/632993

PS: I have already solved it using string but how to solve it by the above method not using string

Modified Code

check out the code
if you have any doubt feel free to ask

1 Like

Only 1test case is passed by this method

look at constraints
x <= 100000000000000000

number is too large you can’t store it in any primary data type like int ,long long int

it will overflow
so using this method you can’t pass all testcases in c++