#OneYearCodingPlan: Recursion and Dynamic Programming
#OneYearCodingPlan : Month 7
In this article, we’ll discuss Recursion and Dynamic Programming for coding interviews.
Timeline
Week 1: Understanding Recursion and solving easy questions.
Week 2: Recursion mediums and hards
Week 3: DP easy questions
Week 4: DP medium and hard questions
Recursion
We all start with recursion by learning how to find the factorial of a number recursively, but interview questions can get a lot more complicated than that. Recursion might seem difficult at first, but it leads to extremely elegant and simple solutions to several problems. Mastering recursion also helps solve several tree and graph questions and helps you break down problems into smaller ones.
A recursive function is a function that calls itself. It is not space-efficient because it fills up the stack at every step. Whenever you hear a problem where there’s a pattern such that every output depends on the output of a few subproblems combined, you know it’s recursion. Another way to detect recursion is if it is a problem that requires expanding over a tree or a graph, node by node, such that the same function can be called for every…