leetcode

49. Group Anagrams

Array Solution code

_n = strs and m = strs[i] and k = alphabet = 26_

Time complexity: O(n m)

Space complexity: O(n k) ~ O(n)

Map Solution code

_n = strs and m = strs[i] _

Time complexity: O(n m)

Space complexity: O(n m)

Sort Solution

_n = strs and m = strs[i] _

Time complexity: O(n m log(m))

Space complexity: O(n m)