Commit e026fa0
committed
Refactor group_anagrams to use character frequency as key
Replaced sorted strings with character frequency tuples as keys for grouping anagrams. This improves algorithm efficiency by avoiding repeated sorting operations for each word. The behavior of the function remains unchanged.1 parent 898aa30 commit e026fa0
1 file changed
+8
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | | - | |
15 | | - | |
16 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
0 commit comments