Reducible_2.py 171 B

123456
  1. def hash_word(s, size):
  2. hash_idx = 0
  3. for j in range(len(s)):
  4. letter = ord(s[j]) - 96
  5. hash_idx = (hash_idx * 26 + letter) % size
  6. return hash_idx