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.
Indeed, with a 25-letters word there are 15,511,210,043,330,985,984,000,000 possible anagrams (25!)
So there is a very slight possibility that you exceed the expected 500ms computation time.
I don't know if you finished it since, because I personally solved this in python and not in ruby. But just in case, you can compute the word index directly from the letters in your word ;)
The Ruby version doesn't follow the Ruby conventions. Accessors shouldn't be named get and set
This comment is hidden because it contains spoiler information about the solution
Check the Python solutions and you'll see. :)
Thanks, that array hack is a bit cleaner that mine.
The Array/Hash accessor
[key]
is very specific to those data structures. If I would read that code in a year, I'd have a hard time seeing at a glance what myUsers
or yourPosition
is for. It just seemed to force a particular implementation and restricting freedom in solutions a little.This comment is hidden because it contains spoiler information about the solution
Doesn't really belong in the OOP category
This one shouldn't be in the OOP category at all
The forced in hash access for
position[n]
is really annoying, why not make it a methodposition(n)
. I basically had to add wrap Array in a class that sutracts 1 from the index.And why test against the live site, a frozen copy of the leaderboard would work just as well.
I found the specs not very helpful when writing my code. BDD should guide me ideally, not confuse me.
A lot of the logic is also quite arbitrary and hard to follow.
What if someone enters a negative number? It should return 0 if something invalid is entered, but this would skip over your initial check in that case and possibly return a negative number.