Ad
  • Custom User Avatar

    It'll fail when called several times in a row because the global var will keep its value. Try that in your computer and you'll see it there too.

  • Default User Avatar

    It works perfectly fine when I test my code

    Everybody who fails says so but they can't test the same tests as at CW. Where you push "attempt" there are lots of tests.

    There is no problem in the kata but a problem in your code. Print inputs and your output to see where the problems are. The exception gives you where they can be.

    Edit: BTW don't post issue but a question when the number of people passing the kata is high in your language (1060 for C++); in that case chances are that your code is wrong somewhere, otherwise somebody would have spotted it before you. Cheers!

  • Default User Avatar

    Thank you for helping me. But can you explain me why I cannot use global variable? It does seem to work perfectly fine when I run it in my local computer.

  • Default User Avatar

    When I tried to attempt the test, it throws a exception what() in stoi (I am using c++). I also tried using stringstream also, but no luck. It works perfectly fine when I test my code. Can someone help me?

  • Custom User Avatar

    That's a problem with your code, are you using a global var?

    C++ Completions 2845

  • Default User Avatar

    May be it is problem in random generated string in tests

  • Default User Avatar

    No, because if I put this string in test sample I have expected result 23

  • Default User Avatar

    If I run the testcase individually, I pass the testcase. But when I run it collectively, it is failing.