Skip to content

Instantly share code, notes, and snippets.

@fcanas
Created May 27, 2015 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fcanas/eea6750c414a39d89b5d to your computer and use it in GitHub Desktop.
Save fcanas/eea6750c414a39d89b5d to your computer and use it in GitHub Desktop.
Swift Squared Same
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