Recursive and Iterative Soluiton