Ad
  • Custom User Avatar

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

  • Custom User Avatar

    It depends on language, but:

    • Parsing as a 32-bit or 64-bit int or long will not work. Maybe it used to, but it definitely should not work in this kata.
    • Parsing to BigInt should be not allowed and should be blocked in languages which have BigInt types. But some languages have poor tests and if you try hard enough, you might find a way.

    General idea of this kata is to perform addition of large numbers "manually", without a support of big integer utilities.

  • Custom User Avatar

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

  • Custom User Avatar

    That's what happens when you don't add logs at the beginning, but put them somewhere in the middle. If you put it on first line, you would notice that your code fails for number 0.

  • Custom User Avatar

    Hi, I got a bit busy with work and life hence the dealy, but I ran my code a couple more times until I found only 6 mismatching results.


    I then continued to write a small console application to test against these values.

    I also manually checked these 6 values.

    And this is what I get:


    input: 92727

    output: 92727

    system result: True

    ManualJob:

    9^5 + 2^5 + 7^5 + 2^5 + 7^5
    59049 + 32 + 16807 + 32 + 16807

    = 92727

    This is True


    input: 187435105

    output: 178759414

    system result: False

    ManualJob:

    1^9 + 8^9 + 7^9 + 4^9 + 3^9 + 5^9 + 1^9 + 0^9 + 5^9
    1 + 134 217 728 + 40 353 607 + 262 144 + 19 683 + + 1 953 125 + 1 + 0 + 1 953 125

    = 178 759 414

    This is False


    input: 24678050

    output: 24678050

    system result: True

    ManualJob:

    2^8 + 4^8 + 6^8 + 7^8 + 8^8 + 0^8 + 5^8 + 0^8
    256 + 65 536 + 1 679 616 + 5 764 801 + 16 777 216 + 0 + 390 625 + 0

    = 24 678 050

    This is True


    input: 980376545

    output: 576257597

    system result: False

    ManualJob:

    9^9 + 8^9 + 0^9 + 3^9 + 7^9 + 6^9 + 5^9 + 4^9 + 5^9
    387 420 489 + 134 217 728 + 0 + 19 683 + 40 353 614 + 10 077 696 + 1 953 125 + 262 144 + 1 953 125

    = 576 257 604

    This is False


    input: 1741725

    output: 1741725

    system result: True

    ManualJob:

    1^7 + 7^7 + 4^7 + 1^7 + 7^7 + 2^7 + 5^7
    1 + 823 543 + 16 384 + 1 + 823 543 + 128 + 78 125

    = 1 741 725

    This is True


    input: 24678051

    output: 24678051

    system result: True

    ManualJob:

    2^8 + 4^8 + 6^8 + 7^8 + 8^8 + 0^8 + 5^8 + 1^8
    256 + 65 536 + 1 679 616 + 5 764 801 + 16 777 216 + 0 + 390 625 + 1

    = 24 678 051

    This is True


    I'm pretty sure I'm not reading the logs wrong :)

  • Custom User Avatar

    Thank you for looking into this Johan.
    Noted: yes its C#, will keep that in mind for future reference.
    I will continue to look into this and provide feedback

  • Custom User Avatar

    They shouldn't. Either C# suddenly has a problem after 7 000 submitted solutions ( unlikely ), or you're reading the logs wrong. I'm going with the latter.

    Please mention which language you're using next time, esp. if a kata has multiple.

    Closing.

  • Custom User Avatar

    My code passes all the tests except for these:
    Random_Number_Test

    Test Failed
    Expected: True
    But was: False

    I decided to log the input, output(my sum answer) and ture or false.
    Please point out why these should be true:

    input 1778653589
    output 645006974
    False

    input 199898839
    output 1952354824
    False

    input 671108264
    output 194989385
    False

    input 793241850
    output 564227289
    False

    Thank you

  • Custom User Avatar

    Hi I'm getting this issue:

    "tests/Fixture.cs(117,15): warning CS0219: The variable 'passed' is assigned but its value is never used"

    Is this a problem with 'tests/Fixture.cs'?