Skip to content

Comments

Completed Hashing-1#2268

Open
sarvanibaru wants to merge 1 commit intosuper30admin:masterfrom
sarvanibaru:master
Open

Completed Hashing-1#2268
sarvanibaru wants to merge 1 commit intosuper30admin:masterfrom
sarvanibaru:master

Conversation

@sarvanibaru
Copy link

No description provided.

@super30admin
Copy link
Owner

Your solution for the Group Anagrams problem is correct and efficient. You have correctly used a frequency array to generate a unique key for each anagram group. The code is clean and easy to understand. Well done!

However, I notice that you included solutions for other problems (isIsomorphic and wordPattern) in the same submission. For future assignments, make sure to only submit the solution for the problem you are being evaluated on. This helps in keeping the evaluation focused.

One minor suggestion for the Group Anagrams solution: instead of using Arrays.toString(freq), you could build a string key by concatenating the frequency counts with a delimiter (e.g., "#") to make the key more compact. However, this is not necessary for correctness and the current approach is acceptable.

For example:

StringBuilder keyBuilder = new StringBuilder();
for (int count : freq) {
    keyBuilder.append(count).append('#');
}
String word = keyBuilder.toString();

But your current solution is correct and efficient as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants