add a brute force method and a recursion method