Difficulty: easy
Given two strings, write a method that checks whether they form an Anagram, meaning the characters in one string can be reordered to produce the other.
func isAnagram(s1: String, s2: String) -> Bool {
// ?
}
isAnagram(s1: "fired", s2: "fried") // true
isAnagram(s1: "fired", s2: "freed") // false
To start working on this challenge open Challenge.swift and uncomment the code skeleton.
To run unit tests that validate your code, uncomment the body of the test method
in ChallengeTests.swift and hit CMD + U
in Xcode. On Linux you can run the
tests by executing swift test
in the package directory.
To view selected solutions open Solutions.swift.