Added brute version of algorithm.