Complete Brute Force Solution