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.
While people are rightfully pointing out why this solution is not recommended, I enjoyed seeing a new way to solve the problem.
This one is not safe as it will mutate the array coming in (it is not a pure function). It is better to spread it into a new array and return the first item in that array and leave the original one untouched.
@Voile I completely agree with the usefulness of a diagram and I did consider it, however overall I thought it would make things too obvious and easy.
The user did say it was "related" to the golden ratio, and the kata is flagged as "puzzle".
It'd be infinitely more useful to put a diagram about the various things. It's still a paragraph vaguely describing the requirement rather than explicitly stating how it is calculated.
@Voile, I'll try and think of another way of writing this, thank you for the feedback
@Voile, I've updated the description, let me know if I missed anything,thank you
Thank you @Voile for the feedback, I will fix this
The
clue
part is not a clue, it's an essential part of the information (otherwise how should anyone figure out what even is the task without looking at the test cases?). But then this paragraph is pretty useless at explaining the task, so it really should be rewritten. e.g:How is
13 / 8
the golden ratio (1.618033...
)?Can the description be more useless than this?
The hash is 4 bytes while the array consists of 2 bytes of numbers, so what does it mean to
mod
them? (Doing it the obvious way doesn't lead to anything.) What does it mean for a validator to "match"? Why ischosenValidator("21e66e37e", [25,5,20,25,20,5])
equal to4
if both2
and4
are20
? There are so many questions.Very cool
Remember you only need to return a boolean, so you don't really need mathematics at all, simply an understanding of probability
Just removed the hack, this version should be deleted
I thought 120 should be included as an incrementing number... Now I realise the trailing "0" should only come after "9"... Hence my hack
arr.join('') !== '120'