Created
May 27, 2015 15:04
-
-
Save fcanas/eea6750c414a39d89b5d to your computer and use it in GitHub Desktop.
Swift Squared Same
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
func squaredSame(a: [Int], b: [Int]) -> Bool { | |
if a.count == 0 || b.count == 0 { | |
return false | |
} | |
return Set(map(a, { $0 * $0 })) == Set(b) | |
} | |
let testResult = test(squaredSame) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment