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.
fixed
fixed
glad i found this answer (i did not think about that). thank you, you are great!
approved
description now states:
fixed
This comment is hidden because it contains spoiler information about the solution
This was an excellent little exercise in sorting logic and value mapping.
It really pushed me to think clearly about how to rank character significance and deal with ties deterministically.
Thanks to the kata creator for the challenge!
Python fork with updated tests.
JavaScript fork (kata author inactive)
this must have been fixed at some point, or was a user error. the test case is now:
The description indicates that out-of-bounds indices should be ignored. Your out-of-bounds
if
guard is misguided:This is checking whether
str[i]
is a nul byte. this will access memory that you should not be accessing, located in addresses beyondstr
. you have to check thati
is within the length ofstr
instead. the strange assertion messages you are seeing are due to you mutating memory that you are not supposed to.by the way, contrary to what the comment in your code implies,
strdup()
is available on Codewars. you just have to declare it somewhere withchar *stdup(const char *);
. this is becausestrdup()
requires C23, and codewars uses C18; butstrdup()
was available on POSIX and Windows long before C23.Haskell fork that fixes the random tests so that failed tests show the input strings along with some other minor improvements to test generation.
This comment is hidden because it contains spoiler information about the solution
Loading more items...