Finds the solution to a mastermind sequence.