Transcript from the "Iterative Loop Solution" Lesson
>> Bianca Gandolfo: So, we're gonna continue with the solution and we're gonna go through the iterative approach. I was mentioning before that being able to translate between recursion and iteration is gonna be key, is a key concept for dynamic programming. There's a couple different techniques for dynamic programming and one core pivot is being able to reason about your recursion in an iterative way.
[00:00:28] So, while this may seem kind of repetitive and maybe a little bit easy at this point, this is the foundation of a bigger picture topic that we'll get to in a little bit. So here's the iterative approach, we initialize our results here. And we can concenate it with our joined string.
>> Bianca Gandolfo: And then at the very end, we'll return the results and also the last one. So if you're not careful, if you do this. Well, so when you run it, you get the secret code but just be careful that if you don't do this you can. It will put an e at the end which is not what you want.
[00:01:21] It kind of messes up our code. Our secret code. So, just keep that in mind. There we go, so that's the solution. How many people got this solution? Yeah?
>> Speaker 2: I did one more step. I put an if statement in there. I don't know why I did that for the minus 1 [CROSSTALK]
>> Bianca Gandolfo: Okay, [LAUGH] no worries. You guys were able to take a stab at the translation?
>> Speaker 2: Close.
>> Bianca Gandolfo: Close. Yeah.
>> Speaker 3: I forgot that there were smiley faces on it so I printed out secret code and I was like, I got it.
>> Bianca Gandolfo: [LAUGH]
>> Speaker 3: And moved on to the other one.
>> Bianca Gandolfo: Yeah. No worries, you weren't looping enough, yeah, cool. Yeah, I think the smiley faces are probably the most important part of that loop or that array so.
>> Speaker 3: [LAUGH]
>> Bianca Gandolfo: Glad went over the solution cuz it would have been terrible.