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.
what a saint
My python code is passing all tests, but times out in the performance section after about 190 tests. I have tried different approaches and on my laptop the code executes in less than 0.1 seconds for arrays as large as 50000 and numbers in the array as large as 1000000. I am struggling to find a more efficient solution. Any one can give me a pointer? Thanks.
Most fun kata I've seen so far but the description really needs to be improved.
Someone should rewrite the description of this kata. I see many complaints below pointing out that the algorithm is incompletely specified.
This is what the description should have said:
In the example the two highest elements are selected each time, likely because it meant the author had to write less lines. You can select any two non-equal elements at random and reach the same answer.
Scala translation
Your code's time complexity is exceesibly high and a more optimized solution can be deduced
Before to even be a programming challenge, this kata is a total riddle as for directives.
Reading
if X[i] > X[j] then X[i] = X[i] - X[j]
, one expects a left to right parsing, and only for immediate neighbour. But then one has to decrypt the example. Let's try with arrow in other direction:It seems we first substract 2 from 3, then 1 from 3, then 1 from 2, then 2 from 3, but lastly we substract 2 from 1. Not left to right, not immediate neighbours, so what? Deep right to left parsing? Greater from next greater? Greater from lower? Strictly none of those. Let's assume it's a deep right to left as far as possible then ending as possible. But what if
[21, 9, 6]
? Plus three poor test cases, can't help a lot.I really like puzzles, and this one could be great as a puzzle if it was clearly stated. If it's not a puzzle, then some things should be clarified, as a lot of people already noticed in discussion. Personnaly, I feel that tagging it as puzzle and replacing misleading instructions with some more examples/tests, would been more interesting… Then one can try it only when in "puzzle solving" state of mind.
Approved
Approved by someone
"you would then check starting from the right again" this does not fit an example.
Then you check an element even if its fit x[i] > x[j], you keep going witout reseting the line, so after make(x[2]) = 3(x[2]) - 2(x[1]) , you next step is check if 1(x[2]) > 1(x[0]).
Am i wrong?
The most difficult parts of such katas is to determine what the blood it`s about.
A did not get it (((
TypeScript translation based on existing JavaScript translation.
You will get the same final answer regardless of which i and j you choose for each iteration, so long as
X[i] > X[j]
.Loading more items...