Data Structures and Algorithms in JavaScript

# Exercise: Recursion Interview Questions

Check out a free preview of the full Data Structures and Algorithms in JavaScript course:
The "Exercise: Recursion Interview Questions" Lesson is part of the full, Data Structures and Algorithms in JavaScript course featured in this preview video. Here's what you'd learn in this lesson:

## In this exercise, you will implement a common recursion questions that are often asked during job interviews.

Get Unlimited Access Now

Transcript from the "Exercise: Recursion Interview Questions" Lesson

[00:00:00]
>> Speaker 1: Question from that channel, what is performant, or more optimized, or better performance?
>> Bianca Gandolfo: Performant means that it runs faster, so given more data, it will be able to compute things faster. That's what it means. So, we'll talk about that more tomorrow when we talk about,
>> Bianca Gandolfo: Big annotation and things like that.

[00:00:30] Run time, what makes algorithms fast, things like that. How to optimize them to go faster. So we'll talk more about that. All right.
>> Speaker 1: I have one pending.
>> Speaker 3: I think he was talking about the wrapper function?
>> Speaker 1: Okay, yes. The wrapper function, this is asked by Eric M, I think that's called a higher order function?

[00:01:00]
>> Bianca Gandolfo: I'm pretty sure a higher order function just means a function that could be passed or returned. So you might wanna double check me on this, but I'm pretty sure it just means that you can return a function, or you can pass a function like data, right? Some languages you can't do that.

[00:01:18] In JavaScript we have that and that makes really cool things happen when we get in to functional programming type
>> Bianca Gandolfo: Worlds, yeah.
>> Bianca Gandolfo: Cool. If you want more vocabulary, like the variable,
>> Bianca Gandolfo: Here. You can call this like a closure variable, you're using a closure here. If you're interested in that, that's all kinda the same.

[00:01:46]
>> Speaker 1: I have a really good link I'll paste into the chatroom.
>> Bianca Gandolfo: Yeah, absolutely.
>> Speaker 1: From Eloquent JavaScript.
>> Bianca Gandolfo: Mm-hm.
>> Bianca Gandolfo: Yeah, and then Kyle has a good class on it as well here on Frontend Masters. All right, okay, so here we are. We're once again at the exercises, how exciting?

[00:02:11] So we are going to move on to number three and number four. I recommend starting, trying to finish most of these as much as possible. The recursion, number four, some of them are pretty tough, so just keep that in mind.
>> Bianca Gandolfo: But they're just basically the most common recursion questions.

[00:02:36] It's almost like you have to memorize them, cuz these are just the questions that they ask, and these recursion exercises are more based off my slides, more based on the conceptual, like how to loop with recursion, and how it all works together? That make sense? So number three should be easier to approach than number four is basically what I'm trying to say.

[00:02:58] But number four, also very important because if you're learning this for interviews, there you are, but they are tough, and that's okay