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.
The two functions are not the same; the second code nests the
y
loop inside thex
loop, causing different behavior, while the first runs the loops separately.This comment is hidden because it contains spoiler information about the solution
langs do not work like that, at least 4 this level
try another algorithm
They are totally not identical, if you open your eyes you will see a difference between them :D
Leading 0's are not perrmited, as no "real" numbers have them (except 0 itself).
Your solution does have leading 0's, "03" != "3"
This comment is hidden because it contains spoiler information about the solution
This kata is great !
This kata is great ! i scratched my head so hard trying to code a simple addition xD
You should treat each string as a representation of a base-10 integer. So, "0" -> 0 and "5" -> 5, so the expected answer is
5
and not the addition of 2 strings which yieldNaN
.I think if leading zeros are allowed, it makes sense to say so in the condition or show it in the example for the task.
JavaScript fixes
Resoved issues (at least for JS): 1, 2, 3, 4, 5
This comment is hidden because it contains spoiler information about the solution
I didn't know the python limtation. My code passes with simple casting with int(). Although I wanted to know maximum length of blocks by this algorithm ,is 4300 digits
Sum digit by digit: 0.454667329788208 seconds
Sum in blocks of 100: 0.02377772331237793 seconds
Sum in blocks of 1000: 0.030898571014404297 seconds
Sum in blocks of 4300: 0.09897232055664062 seconds
ValueError: Exceeds the limit (4300 digits) for integer string conversion: value has 4301 digits; use sys.set_int_max_str_digits() to increase the limit
Maybe your code is too short?
Anyway, "my code is too slow to pass" is not a kata issue. You need to figure out how to make your solution sufficiently fast.
This comment is hidden because it contains spoiler information about the solution
Loading more items...