Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Same issue. Where:
the final carry is ignored when counting; it shouldn't be.
same issue here
I'm using JS too, thanks for looking into it
̶T̶h̶e̶ ̶l̶a̶s̶t̶ ̶o̶n̶e̶ ̶i̶s̶n̶'̶t̶ ̶a̶ ̶c̶a̶r̶r̶y̶,̶ ̶y̶o̶u̶ ̶d̶o̶n̶'̶t̶ ̶c̶a̶r̶r̶y̶ ̶w̶h̶e̶n̶ ̶t̶h̶e̶r̶e̶ ̶a̶r̶e̶ ̶n̶o̶ ̶n̶u̶m̶b̶e̶r̶s̶ ̶l̶e̶f̶t̶ ̶t̶o̶ ̶c̶a̶r̶r̶y̶ ̶t̶o̶,̶ ̶y̶o̶u̶ ̶j̶u̶s̶t̶ ̶a̶d̶d̶ ̶i̶t̶.̶
edit: actually looking in to it, you're right it should count it as a carry
Getting the same issue. My code fails at specific tests. These are tests where one number has more digits than the other, where the longer number begins with 9, and where that 9 would have a carry operation applied to it. My code gets the mathematically correct result, but the test expects one less.
Either the description isn't informatve enough to tell you to ignore cases like this, or the expected results are wrong. I could throw together something that solves the kata by getting incorrect results, but I'd really rather not do that on principle.
Should note that I'm using JavaScript in case this is not a problem for other languages.
I have trouble with one random test :
89953 922317
which is supposed to output 4
I don't see how it can be, I find 5 when I run it by hand. It would be 4 if the carry was not counted in one of the operation which would be incorrect.
log of the operations :
3 7 +1
carryValue 1
carries 1
5 1
carryValue 0
carries 1
9 3 +1
carryValue 1
carries 2
9 2 +1
carryValue 1
carries 3
8 2 +1
carryValue 1
carries 4
0 9 +1
carryValue 1
carries 5
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I'm not convinced that this problem deserves an array and an additional function, looks trendy for sure but not allocating that much memory could be more reasonable.