brute force solution works; still have to finish the efficient one