Difficulty: easy
Given two strings, write a method that checks whether they are the reverse of each other.
func isReverse(s1: String, s2: String) -> Bool {
// ?
}
isReverse(s1: "god", s2: "dog") // true
isReverse(s1: "god", s2: "fog") // 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.