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.
Using
count
instead ofsize
orlength
makes a huge difference:count
traverses an Enumerable, so you're losing a lot of CPU time for nothing, especially on large collections.http://batsov.com/articles/2014/02/17/the-elements-of-style-in-ruby-number-13-length-vs-size-vs-count/
Oh, so I wasn't the only one with that solution. :D
I appreciate the praise :)
Yes I know it, thank you :D
Thank you.
Added a few more test cases to cover that :)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
That's actually one of the things that got me hooked on this site. I don't think I've noticed anyone being less than cool.
These are good points. The down vote ability will probably go away at some point, we just haven't gotten around to updates in that area yet. Down votes are probably going away and will be replaced by the ability to flag, which initially will basically be the same as a down vote except that you have to earn the privilege to use it. Later on we will probably incorporate something more intelligent so that flagging is weighted by some sort of vote reputation.
Fortunately, so far no one really seems to be abusing the down vote ability. Everyone has been pretty... honorable.
I feel like down votes almost always sometimes tend to degrade into a method of 'punishing' people for having a different viewpoint. It's one of the main reasons I don't have a StackExchange/Overflow account. Personally, I reserve down votes for spam and/or abusive comments. If I feel someone else is factually incorrect I'd be more inclined to write a reply citing why I disagree with them. That way, when I'm wrong I have an opportunity to learn something new when someone that's correct replies.
I'd suggest taking a look at how a few other communities handle up/down votes.
Check out Daniweb. They use some form of algorithm where the effect your vote has on a post is determined by how many up/down votes your posts have received.
Newgrounds has a feature that could be adapted. Users can flag submissions/reviews as being against the ToS. When a submission gets reviewed, the results of the review affect a stat of the user(s) that flagged it. If you flag too many items that shouldn't have been flagged, your down votes don't affect a submission. It stays that way until you get in the habit of only flagging things that should be flagged.
I think Reddit does a good job with hidden comments too. When a comment drops below a threshold score, it shows up as something along the lines of "This comment has been hidden due to downvotes [show]".
sold
OK. How about this?
Stupid me - it will be difficult to return the array and the true/false value...
Hmm, the first paragraph makes me think about an elaborate algorithm to distribute the errors evenly over all numbers, and the second one crushes all these ideas... one could add a little complexity:
Loading more items...