-
-
Save giruzou/5d8e8e868d57b62cb11273d698146161 to your computer and use it in GitHub Desktop.
Ruby最大値(max)と最小値(min)の位置インデックス(index)を得る方法 ref: https://qiita.com/DrqYuto/items/4d4f0147659803e38d55
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
a=[1,2].each_with_index.max[1]+1 | |
#=>2 | |
a=[1,2].each_with_index.min[1]+1 | |
=>1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment