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.
hi, made changes
Why is
name
parameterdynamic
? Is there anything wrong with making it justString
?Hi, the test is correct. The result should be 2.
thank you
done for Ruby; JS already done
Codewars challenge api
https://www.codewars.com/api/v1/code-challenges/582e0e592029ea10530009ce
Hi, how do I know who approved the kata
fixed it, thanks.
found the problem there are no simple tests
Hi, I'm the author of the translation, what problem are you talking about, please specify.
Hi, thanks for taking the time to look at my problem. I'll make changes later.
Hi, the solution will pass only if you find a way to solve the problem without loops. as wrotes below in the comments inList numbers are sequentially from 1 to n this should help you to solve the problem without loops
your solution has a bug that incorrectly handles four zeros in sequence
example input data [9, 0, 0, 0, 0, 0, 9]
your code will return [ 9, 0, 9, 0, 0, 0, 0, 0 ]
Suggestions:
add
toint Function(int) add(int n){ ... }
and solution setup to something like:I think that this looks much nicer in strongly typed languages. If someone will solve it with
dynamic
then fine, but static types are so much neater :)add(x)
. Users who do not know how to do "functions in functions" will attempt to return strange things fromadd
, and tests will crash attempting to call an uncallable thing, resulting in confusing failure messages. You can try something likeexpect(add(x), isA<int Function(int)>(), reason: "\nadd(x) should return a function");
, maybe extracted to a helper function like following pseudocode:(make sure to use
reason:
for clear failure messages).Hi I checked
your code gives wrong result for
this sequence [9, 0, 0, 0, 9, 1, 2, 0,
1, 0, 1, 0, 3, 0, 0, 1,
9, 0, 0, 0, 0, 0, 0, 9] can you check locally
Loading more items...