32. Valid anagram
Write isAnagram s t, which is true when t uses exactly the same characters as s, each as many times, in any order, and false otherwise.
Case matters: "a" and "A" are different characters.
Examples
- Input
isAnagram "anagram" "nagaram"Outputtrue - Input
isAnagram "rat" "car"Outputfalse - Input
isAnagram "aab" "abb"Outputfalse
Submitting also runs 9 hidden tests.
Constraints
- Hidden tests include strings of 20,000 characters.
Loading editor…
Type
\to in the editor, or click:Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.
ReadyLn 1, Col 1Lean 4
Draft saved in this browser