Quantcast
Channel: Tweetable hash function challenge - Code Golf Stack Exchange
Viewing all articles
Browse latest Browse all 25

Answer by orlp for Tweetable hash function challenge

$
0
0

Python, 340053

A terrible score from a terrible algorithm, this answer exists more to give a small Python script that displays scoring.

H=lambda s:sum(map(ord, s))%(2**24)

To score:

hashes = []
with open("british-english-huge.txt") as f:
    for line in f:
        word = line.rstrip("\n")
        hashes.append(H(word))

from collections import Counter
print(sum(v for k, v in Counter(hashes).items() if v > 1))

Viewing all articles
Browse latest Browse all 25

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>