Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func groupAnagrams(strs []string) [][]string {
- res:=map[[26]int][]string{}
- for _,s:=range strs {
- count:=[26]int{}
- for _,c:=range s{
- count[c-'a'] +=1
- }
- res[count]=append(res[count],s)
- }
- frs:=[][]string{}
- for _,v:=range res {
- frs = append(frs,v)
- }
- return frs
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement