problem 11 brute force with 1d array