Implement the brute-force algorithm first.