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.
Disagree this is an issue. Booleans are their own distinct primitive in JS, they are strictly not a "special case of
number
". There is no reason the validation logic for this kata should be any more complicated than "is it anumber
?"Good question! I've added a note to source timestamps from
time.time()
to the description and also added the import to the initial solution.The original intention was that any source of timestamps would work, but this is better to avoid ambiguity.
@HananAbSh did you test this solution to find that out, or are you just assuming so?
Kata forked and updated to address all open issues
https://www.codewars.com/kumite/6899181990a07832ede399a2?sel=6899181990a07832ede399a2
Patch notes:
This comment is hidden because it contains spoiler information about the solution
A good start! Things to fix:
for i in range(r-1)
=>for i in range(1, r)
or else you generate tests with underscores at the end - or change the logic.Nitpicks:
random
module has ways to take randomly from iterables already; use for examplechoice(chars)
over'somechars'[random_index]
get_random_test_case(min_length, max_length)
method rather than repeating the same logic twice in the small/large "true random" tests.Suggestion snippet:
Please state which language you're working in when raising issues.
Your Prolog solution is buggy, so I'm closing this īssue as it's not a problem with the kata itself.
To fix your solution, consider what would happen if I called
solution(-1, R)
TypeScript: random test generator was failing to correctly order inputs as per this issue:
Fork with fix here
It's helpful to note what language you're working in when raising issues.
Confirming this is an issue in TypeScript, however. The random test generator is sorting inputs lexicographically rather than numerically. Will post a fix.
Dang programmers, making math all complicated
0 * -1 does, in fact, equal -0 in almost every language's floating point math.
Python list slicing works like this:
list[start:stop:step]
Where
start
is the first index to visit,stop
is the index before which we will stop, andstep
is how far to move at each step of the process.When
start
isn't specified it defaults to 0, and whenstop
isn't specified it means we take the entire list afterstart
. Whenstep
isn't specified it also defaults to 1.Putting this all together,
list[::-1]
means "take the entire list, stepping backwards" - or, in simpler terms, reverse it!It's 90% of a solution.
Fork approved by someone, closing issue.
Loading more items...