what will be the answer if there are more than one group of anagrams.
eg: abc, cab, bca, dsa, asd, sad
here there are two groups one is abc, cab, bca and the other one is dsa, asd, sad.
Atul your answer will be the entire vector because it contains 2 groups having more than 1 string.
If your string is -
abc, cab, bca, dsa
then your answer should be abc, cab, bca because for dsa there is only single string.
For your question -
abc, cab, bca, dsa, asd, sad
the answer will be abc, cab, bca, dsa, asd, sad because it contains two groups and in each group there are more than 1 element.
Abhijeet your batchmate :)
At first, I thought it should return an array of arrays of strings, in which each array of strings contains a group of anagrams. But in C++ default code just sets the return type as
vector<string> rather than vector< vector<string> >...
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.