Changed as a comparison between recursive menoization and loop