Conversation
|
Your solution for grouping anagrams is correct and efficient. You have correctly identified that anagrams have the same character frequency, and you used that to create a key for the hash map. The code is clean and well-commented. One minor point: the key generation using Another common approach is to use a string of characters representing the frequency, but your method is straightforward and correct. Overall, great job! |
|
Your solution for GroupAnagrams is correct and efficient. It correctly groups anagrams by using a frequency array and a hash map. The time and space complexities are optimal. The code is clean and readable. One minor suggestion: Instead of using map.computeIfAbsent(key, k -> new ArrayList<>()).add(str);This avoids the need for two operations (putIfAbsent and then get) and is more idiomatic. Also, note that the key generated by Overall, great job! Your solution is correct and well-implemented. |
No description provided.