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.
I'm just now seeing this! I was very new to ruby and programming haha. I flinched and then smiled looking at this code just now ;)
Well this is very clever and an extremely fast O(1) solution, but it may not be obvious to most people what this giant line of computation is doing, so probably it's not very clear. Took me about 45 seconds to realise what it was doing and then I thought "oh wow thats amazing how come I didnt think of that..."
It definitely isn't. Using someone else's code without actively engaging in the process of developing an algorithm yourself is not a good practice. What if you encounter a specific problem in the future that doesn't already have an existing solution? You will likely face difficulties in finding a way forward. Additionally, if an interviewer asks you to solve a similar problem and you solely rely on someone else's code, it will significantly decrease your chances of getting the job.
Yep, came to post the same thing.
and no floats :)
This comment is hidden because it contains spoiler information about the solution
I find this solution very interesting and impressive!
There is no magic: it simply checks the input number against the precalculated list of "strong" numbers.
Man, i'm dumb. I'm still unable to understand what magic you worked there...
no.
Not exactly: this is the list of all such numbers.
Thanks! :)