Timeline for Leetcode 49: Group Anagrams - Hash function design talk
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 5, 2017 at 22:15 | comment | added | Jianmin Chen | After careful review and comparison between using key with 52 bytes and using hashing function depending on string's maximum length, I chose this one as my answer. Thanks JS1 for great help. | |
Feb 5, 2017 at 22:11 | vote | accept | Jianmin Chen | ||
Feb 5, 2017 at 18:41 | comment | added | Jianmin Chen | Choice of key - your space analysis is correct. The sorted string uses O(n) space but my string uses O(logn) space. I also felt that a minimum of 51 bytes key looks like silly, I am the designer, but it works based on simple reasoning. Not so tough as defining a hashing function, dealing with a prime number. | |
Feb 5, 2017 at 18:28 | comment | added | Jianmin Chen | Not really a hash - I agreed with you. Here is one of approach using hash function, I will test it against Leetcode online judge. gist.github.com/jianminchen/f75daa6055d7f0cb448b5248367551fc | |
Feb 5, 2017 at 10:09 | history | answered | JS1 | CC BY-SA 3.0 |