You are given a slice of strings.
input = []string{string1, string2, string3, ...}
Club all the anagrams
together in slice of slice of strings.
- Handle edge cases of input strings.
input = []string{"fed", "bca", "def", "cab", "xyz"}
Slice1 = []string{"bca", "cab"}
Slice2 = []string{"def", "fed"}
Slice3 = []string{"xyz"}
output = [][]string{{"bca", "cab"},{"def", "fed"},{"xyz"}}
func ListAllAnagramsInSlice(wordList []string) [][]string
Function ListAllAnagramsInSlice solves the given problem using hashmap and iterating over each string and updating the map.
Finally, it sorts the map and returns the result as a slice of slice of strings.
Run the tests already provided.
go test -v