Given an array of strings, return all groups of strings that are anagrams. Represent a group by a list of integers representing the index in the original list. Look at the sample case for clarification.
Anagram : a word, phrase, or name formed by rearranging the letters of another, such as
'spar', formed from
Note: All inputs will be in lower-case.
Input : cat dog god tca Output : [[1, 4], [2, 3]]
tca are anagrams which correspond to index
god are another set of anagrams which correspond to index
The indices are 1 based ( the first element has index 1 instead of index 0).
Ordering of the result : You should not change the relative ordering of the words / phrases within the group. Within a group containing
i < j.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.