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.
I wouldn't consider the concept of odd and even numbers as university level math but ok.
This comment has been deleted.
This comment has been deleted.
Thank you mr replyguy, I am very well aware.
It's not that there are 8000 other katas to solve...
Literally cannot understand any sentence of this kata's description. Really wish this site was actually codewars and not puzzles for people who studied mathematics at university...
I just realized I totaly swapped left and right. You'd think I'd remember which one is left after 28 years...
what about this ?
This just barely passes the "cpu playing against itself" tests, but has a few known bugs:
Next time I would prefer that instead of relying on implementation details such as ordered dicts/Maps you simply provide an array of tuplies (i.e. the result of
functions.entries()
in JS). the V8 engine happens to also have ordered Maps and Sets, but that is not guranteed to happen in other JS engines.for anyone solving this currently and confused by this edgecase: The solver appears to expect the output array to grow by at least 2 on each iteration, so if your result is an empty array after trimming leading and trailing zeroes you can create a new array of list.length + 2 and fill it with zeroes.
This kata very badly needs to be updated, there are no tests anymore and while the description asks for a "generator" it does not actually mean generator functions which now exist in JavaScript.
I'd like to add that this should in theory be using a linked list instead of an array, since it's having to re-index the array on every yield, which becomes a lot of work for large sequence sizes (like the pointless sequence test). Didn't time out here, so I guess array is acceptable :)
technically creates extra numbers, but I like how small this solution is without becoming an unreadable nightmare like 99% of the "best" solutions on here. Great work!
While trying to debug my solution I managed to find out that codewars allows for the injection of arbitary HTML via console.log. At least it removes script tags, so there's no immediatly obvious XSS vulnerability here. Still super annoying since it means I'll need to sanitize my own logs now.
For reference here is the log function I used for debugging my solution:
Loading more items...