@@ -38,19 +38,19 @@ void main(List<String> args) {
3838/// The time complexity of this variant is `O(n * k * log(k))` , where `n` is the length of
3939/// the input list `strs` and `k` is the maximum length of a string in `strs` .
4040
41- List <List <String >> _groupAnagrams (List <String > strs) {
42- Map <String , List <String >> anagramGroups = {};
43- 44- for (String str in strs) {
45- String sortedStr = String .fromCharCodes (str.runes.toList ()..sort ());
46- if (! anagramGroups.containsKey (sortedStr)) {
47- anagramGroups[sortedStr] = [];
48- }
49- anagramGroups[sortedStr]? .add (str);
50- }
51- 52- return anagramGroups.values.toList ();
53- }
41+ // List<List<String>> _groupAnagrams(List<String> strs) {
42+ // Map<String, List<String>> anagramGroups = {};
43+ 44+ // for (String str in strs) {
45+ // String sortedStr = String.fromCharCodes(str.runes.toList()..sort());
46+ // if (!anagramGroups.containsKey(sortedStr)) {
47+ // anagramGroups[sortedStr] = [];
48+ // }
49+ // anagramGroups[sortedStr]?.add(str);
50+ // }
51+ 52+ // return anagramGroups.values.toList();
53+ // }
5454
5555/// NB: The sorting variant is slower than counting the frequency of each character.
5656/// However, the second algorithm may be faster than the first algorithm for inputs
0 commit comments