solve problem 43 in brute force