Skip to content

Instantly share code, notes, and snippets.

@er2
Created August 4, 2023 02:20
Show Gist options
  • Save er2/e086c09538ee75212ee1107c865e24db to your computer and use it in GitHub Desktop.
Save er2/e086c09538ee75212ee1107c865e24db to your computer and use it in GitHub Desktop.
def isAnagram(s1: String, s2: String): Boolean =
(s1 diff s2).isEmpty
isAnagram("barbie", "oppenheimer").ensuring(_ == false)
isAnagram("race", "care").ensuring(_ == true)
isAnagram("tree", "tere").ensuring(_ == true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment