Implemented the recursive solution, still need to implement time estimation