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 answer is what the kata asked for, not the top voted solution. I think this should be top voted.
This comment is hidden because it contains spoiler information about the solution
It's a brillant solution.
I always forget to inline and return the index I want all together. This makes it much cleaner. 👍
This comment is hidden because it contains spoiler information about the solution
This is N Log N time complexity. This task can be completed in N.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
array_keys has a search_value parameter my life is changed
Oh! Now I see it! The starting code was with a constructor function so I assumed this problem was also with one. My bad, next time I should double check ;)
This code does create a method on the prototype. It does not create a separate function for every Ship instance. Test it for yourself if you don't believe me :)
It's better to attach the function on the prototype : Ship.prototype.isWorthIt = function(){ ... } because you create the function once and every instance of the Ship constructor can use it while in your code you create a separate function for every instance :)
again interesting solution
five years working with php and didn't know about this function... wtf was I doing?
Can't believe I did a nested loop for this! ^-^
Loading more items...