@@ -38,19 +38,19 @@ void main(List<String> args) {
38
38
/// The time complexity of this variant is `O(n * k * log(k))` , where `n` is the length of
39
39
/// the input list `strs` and `k` is the maximum length of a string in `strs` .
40
40
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
+ // }
54
54
55
55
/// NB: The sorting variant is slower than counting the frequency of each character.
56
56
/// However, the second algorithm may be faster than the first algorithm for inputs
0 commit comments