16.12.2023
242. Valid Anagram easy
blog post
Join me on Telegram
https://t.me/leetcode_daily_unstoppable/440
Complexity
Time complexity:
O(n)Space complexity:
O(n), can also be solved in O(1) by computing thehash
Code
fun isAnagram(s: String, t: String): Boolean =
s.groupBy { it } == t.groupBy { it }