Implement in both iterative & recursive way.