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.
This is by far the most performant and elegant solution.
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)
.I don't think modular arithmetics is basic math, but I guess that is a matter of perceptioin.
That kata now already has a Java translation. Also this kata requires to merge the frequency count and prime factors in string format, so technically not an exact duplicate.
Also, duplicates of Prime Factorization katas has been mentioned here and will be handled sooner or later.
Corrected!
Thanks for the feedback!
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.
I dont know why Swift translator added it here, but other translators have not. Its been reported before too.
why there is no this check in python?
swift can't pass
It feeds your solution with an infinite sequence and checks if it stops as soon as the answer is known, without evaluating the whole input.
Swift:
what is Laziness Tests?
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
Loading more items...