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 comment is hidden because it contains spoiler information about the solution
beatiful
Personally, I find loops harder to read and just as error prone as regular expressions. And it's a nice opportunity to practice them regexes :)
That last return statement was really clever!
The provided test cases include the first terms, and oeis.org (and I assume Wolfram Alpha) have a search engine that allow you to find sequences of numbers by entering a part of that sequence
Then, sift through what comes up, implement the
formula
, and voilĂ .Granted, the challenge becomes less coding than knowing where to look for the answer. But that's fun in its own right too
I find it a bit overkill to use regex (or array helper methods) when you can simply loop through the array, which probably has better performance and better readability lol.
Still a good solution though.
Would be more efficient to save Math.sqrt(num) into a var instead of calculating it every loop iteration, I think.
Also - really liked this little bit at the end: return num > 1;
Clever - allows to not have a separate error check for num<=1
This is really good, saved it to the memory bank, to try it out myself, quick google reveals it works because you have a fallback/default as last option which stands in for the 'false' part of the syntax. Very nice.
This comment is hidden because it contains spoiler information about the solution
1 rotation to the left === (s.length-1) rotations to the right though..
I feel like the precision in the kata description was more of a context clue, to not get devs confused as to what exactly the author was referring to with the word 'rotation'
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I think it would have been better to calculate the square root only once outside the loop :)
hint for anyone trying this kata even if the description says not to (in JS at least):
"Person" is misleading in the way it has been capitalized..
once you get past that, the kata is still 8kyu, even when working the solution back from the tests results
I hope that this is not too much of a spoiler, since the description gives nothing, i figured a little hint would be nice.
Please, use spoiler flag, your comments in the solutions are visible in the Home page Discourse.
Loading more items...