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.
Horrible solution. Perfect example of how to kill performance by making code shorter. Solutions here are expected to have
O(n)
and compete only in number of passes through the list, but this one manages to get toO(n^2)
.There is an issue for original kata and you better not inherit it. There really should be explicit tests with repeating minimum in the array. For example
[3, 4, 3, 5]
should produce6
, not7
. I guess, single fixed test is ok.The solution is incorrect. It fails if the minimum element repeats anywhere in the array.
This comment is hidden because it contains spoiler information about the solution
Ants NEVER collide more than 2 at once in one place. In this case particularly the middle one first collides with the right one and then (after changing direction) with the left one:
(time goes from top to bottom)
There is a harder version of this kata. https://www.codewars.com/kata/65e4b8877e8acd0dbae9a14f
There is wider kata about computing regular expressions for divisibility tests. https://www.codewars.com/kata/5993c1d917bc97d05d000068
Instead of having single
@Test
with loop inside (it is actually many tests!) use@RepeatedTest
instead.Added to description and tweaked slightly some tests
Good point! Done
This comment is hidden because it contains spoiler information about the solution
Many stateless classes have their methods non-static despite of possibility to have them static. As there is no reason to be non-static there is no reason to force methods to be static. And yes, there will be more difficult version of the kata featuring infinite iterators.
I know all of this, I plan to add more difficult version
Disastrous performance. How could this be a top voted solution?
Why is it so?
Loading more items...