Created
March 17, 2018 15:35
-
-
Save MozyOk/535b400549dd5e393e98a03dd039953e to your computer and use it in GitHub Desktop.
arrayにnilが入るときの処理がcleverでいい感じのコード
This file contains 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
def comp(array1, array2) | |
array1.sort.map {|num| num ** 2} == array2.sort | |
rescue | |
false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.codewars.com/kata/are-they-the-same/ruby
に関して