Created
June 28, 2012 07:22
-
-
Save suginoy/3009658 to your computer and use it in GitHub Desktop.
Calculate max size of nested array using inject method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[1, 2], [1, 2, 4, 5], [3]].inject(0) { |r, i| r = i.size if i.size > r; r } # => 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment