filmov
tv
Maximum sum of pairs with a specific difference using dynamic programming

Показать описание
I work hard every day to make sure that Joey'sTech becomes a go-to place for you when it comes to dynamic programming problems and solutions.
A lot of students and programmers have this regular question of how to solve dynamic programming problems?
What to do such that the approach clicks to them automatically?
The answer to this question is practice.
Practicing dynamic programming problems of different levels of difficulty is the only work standing between you and future-you who is a dynamic programming
expert.
My efforts are aligned with this approach only thus I work hard to bring for you dynamic programming problems examples of varying difficulty.
All you have to do is sit with a pen and a notepad and follow along with the videos of Joey's dynamic programming tutorial.
Once you have absorbed the DP problem taught in any of the videos and the way to construct its algorithm, then you must solve it again on your own once or twice
and perhaps create a program around it.
This will build the basics right, make the approach clear and with each problem, you solve you will start getting better at solving computing problems.
In this video of Joey'sTech, you are going to learn one of the dynamic programming basic problems which is quite interesting and fun to solve.
The problem goes by the title 'Maximum sum of pairs with specific difference'.
Starting from here is its problem statement
-----------------------------------------------
At the center of this problem is an array of integers and a number denoted by variable k.
You can form a pair of any two integers from this array if the difference between the 2 integers is strictly less than k.
Your task is to find out the maximum possible sum of disjoint pairs formed from this array.
Remember the world disjoint that means if an integer is used in a pair then it can't form pair with another integer.
The array around which we will construct a dynamic programming algo will be
3, 5, 10, 15, 17, 12, 9 and k=4
Below are some disjoint pairs that can be formed from this array
3,5 10,9 12,15
The sum that comes out from these pairs is 3 + 5 + 10 + 9 + 12 + 15 = 54
But, it's not certain whether this is the maximum possible sum or not. Let's switch to the framework and find out if it is a maximum sum or not.
If 54 is not the maximum sum then what the maximum possible sum is?
We will find that out in this video.
Watch more Dynamic Programming problems from the channel of Joey'sTech
Find a path with the maximum average value
The maximum sum of a path in right number triangle
Count possible paths to reach origin
Trapping Rain Water using dynamic programming
A lot of students and programmers have this regular question of how to solve dynamic programming problems?
What to do such that the approach clicks to them automatically?
The answer to this question is practice.
Practicing dynamic programming problems of different levels of difficulty is the only work standing between you and future-you who is a dynamic programming
expert.
My efforts are aligned with this approach only thus I work hard to bring for you dynamic programming problems examples of varying difficulty.
All you have to do is sit with a pen and a notepad and follow along with the videos of Joey's dynamic programming tutorial.
Once you have absorbed the DP problem taught in any of the videos and the way to construct its algorithm, then you must solve it again on your own once or twice
and perhaps create a program around it.
This will build the basics right, make the approach clear and with each problem, you solve you will start getting better at solving computing problems.
In this video of Joey'sTech, you are going to learn one of the dynamic programming basic problems which is quite interesting and fun to solve.
The problem goes by the title 'Maximum sum of pairs with specific difference'.
Starting from here is its problem statement
-----------------------------------------------
At the center of this problem is an array of integers and a number denoted by variable k.
You can form a pair of any two integers from this array if the difference between the 2 integers is strictly less than k.
Your task is to find out the maximum possible sum of disjoint pairs formed from this array.
Remember the world disjoint that means if an integer is used in a pair then it can't form pair with another integer.
The array around which we will construct a dynamic programming algo will be
3, 5, 10, 15, 17, 12, 9 and k=4
Below are some disjoint pairs that can be formed from this array
3,5 10,9 12,15
The sum that comes out from these pairs is 3 + 5 + 10 + 9 + 12 + 15 = 54
But, it's not certain whether this is the maximum possible sum or not. Let's switch to the framework and find out if it is a maximum sum or not.
If 54 is not the maximum sum then what the maximum possible sum is?
We will find that out in this video.
Watch more Dynamic Programming problems from the channel of Joey'sTech
Find a path with the maximum average value
The maximum sum of a path in right number triangle
Count possible paths to reach origin
Trapping Rain Water using dynamic programming
Комментарии