brute force and hash table