PUZZLE TIME how would you implement in ruby a method that takes ["a", "b", "a", "c", "c"] and returns {"a" => 2, "b" => 1, "c" => 2} ?
-
-
@carols10cents also, you could do it with chunk{|x|x} instead of using itself -
@coreyhaines yeah that was my original answer actually, but i wasn't crazy about the block-yielding-the-thing part! - 2 more replies
New conversation -
-
-
@carols10cents that's pure ruby 2.2. :)Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.