Imagine you have a bag of coins where each coin is of value 5 dollars and you have to find the total amount of money available in that bag, What would you do to find the total amount in the bag?

Imagine you have a bag of coins where each coin is of value 5 dollars and you have to find the total amount of money available in that bag, What would you do to find the total amount in the bag?

You count the number of coins and multiply it with 5 dollars. So if the number of coins came out 100 then you have 500 dollars amount of money.

Now if I add 10 more coins of 5 dollars in that bag, How much is the amount now?

Photo by Josh Appel on Unsplash

Yes, you are right, the answer is 550 dollars. Now take a moment and try to Imagine how you calculated this answer. Did you count all the number of coins in the bag and multiply it with 5 dollars?

No, you already knew that the bag had 100 coins and by adding 10 more coins the total number of coins is 110 and when you multiply 110 with 5 dollars you get 550 Dollars.

This approach to Problem Solving is called Dynamic programming. You store the answer of a subproblem in memory and use that to solve the problem.

But this approach cannot be used to solve all types of problems. So How do you Identify whether a problem can be solved with Dynamic Programming?

**The problem can be divided into smaller subproblems****The Subproblems should be overlapping****It should show the optimal substructure property, for example: finding the shortest, longest path, or maximum or minimum amount.**

The Dynamic Programming Problem can be solved with two approaches:

**Top-Down Approach****Bottom-Up Approach**

We will learn about both the approaches by solving a popular Dynamic Programming problem called the Partition Problem from LeetCode.

problem-solving javascript interview-questions dynamic-programming leetcode

Top Android Interview Questions & Answers from Beginner to Advanced level. Get ready to crack your next android interview with these android interview questions

Dynamic Programming Interview Questions: Unique Paths . Dynamic programming is a method for solving a complex problem by breaking it down into a collection of simpler subproblems, solving each of ...

Find the maximum profit you can make from a given list of jobs. Dynamic Programming Interview Questions: Maximum Profit in Job Scheduling. Today’s problem is challenging — a classic problem you may have seen in your algorithms courses. For those of you who’ve already seen it, this will serve as a great comprehensive review. If it’s new to you, take your time to digest it all.

Want to improve your problem solving skills and ace coding interviews? This videos shares coding interview tips and coding problem solving techniques. These problem solving programming tips will help you break down problems and solve more complex programming questions.

In this video, I will be talking about problem-solving as a developer 🔴 Subscribe for more https://www.youtube.com/channel/UCMA8gVyu_IkVIixXd2p18NQ?sub_confi...