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.
Wish I knew this earlier
It's not programming. Geometry yes, math yes, but not programming.
JavaScript:
mocha
&chai
should be used instead of the deprecated Codewars test frameworkthanks a lot, approved
python new test framework is required. updated in this fork
Do the same solution. So, vote for this as THE Best Practices. ))
Random test display for "Catalyst" is bugged, it always says
should be played on turn 0 on enemy no. x
, which cannot be correct since there are no poison stacks in turn 0.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Thanks!
Fixed and updated
Hey, an interesting scenario, but this should be treated the same way as any other. Let's say we have an array
[-5, 10, 8, 10, 2, -3, 10]
; as you can see there are 3 occurences of10
, but still the algorithm works the same way: the greatest is10
, so it goes in the middle, the next greatest is10
, so it goes on both sides, then10
again on both sides, and after that the other numbers accordingly, resulting in[-5, -3, 2, 8, 10, 10, 10, 10, 10, 8, 2, -3, -5]
. I added this to the tests for clarity nevertheless.In the test cases where there are 1000 elements or more in the data array, the max number may not be unique. For example, if the max in the array is 1000, there can be multiple 1000s.
This raises a question about how we should deal with the existence of multiple max numbers:
Should we take them as just one element?
Should we place the group of max numbers in the middle, and then arrange the rest of numbers in the mirroring fashion?
Moreover, we may have an odd or even number of max numbers. Under the requirement of returning an array with an 'odd' number of elements in it, things can get more complicated.
This possibility of having multiple max numbers and how it should be handled should be mentioned in the description, and the test cases may need to be reexamined as well.
You can unpack any iterator with an asterisk, but the type of collection is still unspecified. Try printing out an iterator such as map, filter, or enumerate. Then try to print that object with an asterisk. You can see the numbers, but if you look closely, there is no parenetheses or square brackets or curly brackets. The unpacked numbers also can't be indexed if you didn't specify the collection type such as list, tuple, dictionary, or set
Loading more items...