• I don't know exactly in this case, but you cannot solve this kata using normal string to integer (or long, or long long...) conversions. That's the point of this kata. At some point you get values that overflow any class of numbers in C++, I guess that's what is happening.

  • Error i get:

    Test Results:
    Caught std::exception, what(): stoll
    Caught std::exception, what(): stoll

    does it mean i can't use stoll()? (i use c++)

  • It does not work because in the node vs 8 it had not yet been implemented.

  • Because it would make the kata trivial and not worth of its rank. This kata is ranked blue for a reason, and it's supposed to be difficult.

  • Can I know why BigInt() is not working !!

  • I had wrong char to int parsing function.
    Worked locally but not on CW

  • I would just like to know if there is some minor compiler setting that I might have overlooked and it caused my tests to fail...

    No, Codewars does not require you to mess with compiler options to get things to work. If your solution does not pass tests for some reason, the code is most probably not completely correct.

    I am available on Codewars Discord, but you can post your code here in the kata discourse even if it does not pass tests: https://docs.codewars.com/training/troubleshooting#post-discourse

  • I would show it to you but I cannot post it because it does not pass tests.
    Possibly on discord if you are there but in the end I know I made it work and so I do not need a robo testing to tell me "You did it"...
    When I posted this comment it was more out of stress that I spent like 30 minutes on testing and looking for compiler settings to see if everything is setup properly (it is) and it still did not work...
    So I am not going to be mad about it. I would just like to know if there is some minor compiler setting that I might have overlooked and it caused my tests to fail...

  • Not sure but seems like the solution is presented right away here... and tests don't seem to be working?

  • My c++ solution still works, so I believe the kata is OK. its hard to say without seeing your code, but if i were to guess, I'd check if you have no trailing or leading junk characters in returned string.

  • Ok.... I just literally compiled my program using Clang 8 C++17 and got this output in the console:


    with the tests being set up as:

    LOG( add( "123", "456" ) );
    LOG( add( "0", "0" ) );
    LOG( add( "99", "2" ) );
    LOG( add( "10", "35679" ) );
    LOG( add( "", "5" ) );
    LOG( add( "192", "" ) );
    LOG( add( "9999", "1111" ) );

    where #define LOG(x) std::cout<<x<<std::endl;

    While here the thing fails on 35689 because for some reason and I have really no clue why my program returns 35779...
    I tried to send it as an attemp. It literally finished 35689 with no issue... Instead 11110 returned 21110... But as you can see from my local output... IT DOES WORK... Can we get more information about what is and is not available to us? Because locally my code succeeds 100% of the time.
    Here like 80% and so it fails the tests...

  • Thank you, I finally got it! My mistake was that I iterated i from 1 to s1.length and therefore the 0th character of s3 (that after reversion became the last) was skipped.
    I had tried running it in VS, but VS doesn't show this "null-character". I found it via an online compiler.

  • Your solution contains an off-by-one error which causes some trash to appear at the end of your string.

    The error is 100% reproducible, so you should be perfectly able to find it running your solution in your local IDE and stepping through it with a debugger. Did you try?

  • This one is older.

  • This comment is hidden because it contains spoiler information about the solution

  • Loading more items...