Skip to content

Hashing#2265

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

Hashing#2265
nagasai67 wants to merge 1 commit intosuper30admin:masterfrom
nagasai67:master

Conversation

@nagasai67
Copy link

No description provided.

@super30admin
Copy link
Owner

Your solutions are well-implemented and demonstrate a good understanding of hashing techniques. For the anagrams problem, the prime number hashing is a clever and efficient approach. However, note that in practice, for very long strings, the product of primes might become very large, but Python's integers can handle it. Alternatively, you could consider using a tuple of character counts as the key, which is also O(K) per string and avoids large numbers, but your current method is efficient and correct.

For the isomorphic strings and word pattern problems, your solutions are straightforward and correct. You correctly check for both one-to-one and onto mappings.

One minor suggestion: in the anagrams solution, you might want to add a comment explaining why prime numbers are used (to ensure uniqueness of the product for each set of characters). This would make the code more understandable to others.

Keep up the good work!

@super30admin
Copy link
Owner

Evaluation completed, but no feedback text was generated.

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.

3 participants