Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hashfunction - design a hash function for Leetcode 49
int Fun(string s, int l, int r)
{
var ret = new int[26];
for (int i = l; i <= r; i++)
ret[s[i] - 'a']++;
int x = 0; // Julia's comment: should be 1
for (int i = 0; i < 26; i++)
x = x * 701 + ret[i];
return x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.