add Recursive algo for this issue