Optimal Strategy for a Game Dynamic Programming
Вставка
- Опубліковано 26 сер 2024
- Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we discuss the problem optimal strategy for a game using dynamic programming. In this problem,
1. You are given an array(arr) of length N, where N is an even number.
2. The elements of the array represent N coins of values arr1,arr1...arrN.
3. You are playing a game against an opponent in an alternative way, where the opponent is equally smart.
4. In this game, a player selects either the first or the last coin from the row in every turn, removes it from the row permanently, and receives the value of the coin.
5. You have to find the maximum possible amount of money you can win if you make the first move.
To attempt and to submit this problem, click here: www.pepcoding....
For a better experience and more exercises, VISIT: www.pepcoding....
#dynamicprogramming #algorithms #datastructure
Have a look at our result: www.pepcoding....
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
That one line"When you do things DO YOUR BEST and when things happen to you assume the worst case" sums up the whole question. Thank you for this !
Plot twist... they are not talking about the question, they are talking about life 😊
@@rohhittz Hence, algorithms are applicable in real life too!
@@pratikchakraborty8058 yess..✅
This is a crime against other UA-cam Channel.
Simply the best.
Haha Glad to know that you liked the content and thank you for appreciating.
The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
So, keep motivating, keep learning and keep loving Pepcoding😊
This video teaches a life lesson: "When you do something, do your best. But when things happen to you, prepare for the worst", BTW amazing content sir
hope for the best prepare for the worse ......
i was just about to comment that, and then i saw your comment on top. Lol. Murphy's law apparently.
This man teaches things on next level, keep making the superb content sir..
Thankyou beta!
I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
@@Pepcoding Done sir😊😊
POTD tha ajka Meine min aur max ka condition k bare mein nhi socha tha sirf max lekar forward ja raha tha. Great video samjh agya pura
You teach so well that at 7:50 , I got concept of the entire video and didn't had to watch the entire video. You are great
same bruh
Yes,opponent also trying to win[so he also will take the maximum value] .this is the main logic to understand for whole question
I saw this video few weeks back to understand a solution, i came back here to mention how useful this video was in applying logic to other similar questions....great video sir!
ek number sir, seriously. Main kisi bhi sawal me stuck ho jata hu toh sbse pehle youtube pr aapki videos search krta hu. Next level explanations hoti hai aapki.
thank you
Scratched my head for almost 2 3 hours for knowing why we are doing in min operation rather than max operation
And when I saw the video, I got the reason in just 2 to 3 min, you have explained this thing in such a fantastic way
Thanks, you style of teaching is phenomenal
🙏🙏🙏🙏🙏🙏
Thank you so much beta aur agr questions banne lge to ghamand nh krna aur agr naa ho to haar nh maan ni.
Aur aise h apna pyaar bnaye rkhe aur pdte rhe😊
what is wrong in selecting max? i am still not able to get?
Sir ek to aapki teaching itni lajawaab and usko jb dark mode pe implement krre to maza hi aajata h.
You are best.
Haha...thankyou beta!
Keep watching and keep learning
u explained the entire question in one philosophical line....................wow
Excellent explanation sir... I was so confused in this question before this explanation.
One of the best explanations on Optimal game strategy, feels very much enlingtned after watching this
Glad to know that you liked the content and thank you for appreciating.
The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
So, keep motivating, keep learning and keep loving Pepcoding😊
if i will join the pepcoding in the future ,reason will be sumeet sir,he is amazing teacher i have ever met.
The way you explain is just outstanding. Couldnt understand this by reading leetcode solutions
In telugu theres a phrase which is apt "em chappad ra" (sunil meme). world class teaching.
I've just started to understand how works dynamic programmation thanks to you
Hope you like the video, we are going to upload 3 lakh+ videos on our platform nados.pepcoding.com
You will find better experience and precisely arranged content.
And for more updates keep following us on Instagram instagram.com/pepcoding/
This question came in the online coding round of Loginext solutions!Thanks for the video.
The smoothest explanation in UA-cam history
Hello, sir, I have 11 years of experience working but this type of concept explanation is really brilliant. Thanks for posting such videos.
..same company from the beginning !?
Sir you are god of programming!!
Simply best and you concentrate on building the fundamentals instead of just reading out the code....
Thanku so much sir!
GOD LEVEL EXPLANATION❤️
👐 keep motivating, keep learning and keep loving Pepcoding😊
When pepcoding happens to you it's the best 👍
u teaching is just awesome. I m able to understand everything
A huge thanks for doing this. I would like you to explain why DP applies in this problem when we are building the tree. You are the only channel that I have seen put your back into it to make sure that its readers learn something. Keep up the good work, Sir.
sir your videos have been helping me since 1 month. THNX so much
kaafi fun to learn tha ye question. Thank u sir for teaching it this good. East or west sumeet sir is the best
Keep learning, Keep growing and keep loving Pepcoding!😊
this is the best explanation available in internet for this problem. Thank you
Glad it was helpful!
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
I really liked the explanation, there cannot be a better explanation than this but code mei aate hi gap strategy thoda explain krte toh easy hota smjhna, also I feel many a times you were just repeating things too many times which could be avoided and make the video shorter.
The best explanation. I always love to watch your explanations.
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
If you like our efforts, we request a review
g.page/Pepcoding/review?rc
You can subscribe to our channel here
ua-cam.com/users/Pepcodingabout?view_as=subscriber
Such a great teacher you are. I am feeling regret that I found this channel so late😢
Thank you for such a good explanation Sir .Just keep uploading videos and give us tricks to approach DP and greedy problems.
You are a great teacher
In search of gold we found Diamond...Sir U beauty ❤️
Glad to know that you liked the content and thank you for appreciating.
The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
So, keep motivating, keep learning and keep loving Pepcoding😊
@@Pepcoding ❤️
Finally I understood this question, thanks for wonderful explanation :)
Glad to know that you liked the content. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. If you like our efforts, will you like to write a review about us here - g.page/Pepcoding/review?rc
kitta awesome padhate hai yrrrrrrrrr😘
I try lot of videos ,this channel saved my life
bahut badiya explanation
keep motivating, keep learning and keep loving Pepcoding😊
also sir can you add link of the video in which gap concept you had taught
Sir you are made for teaching . Thank you very much for your efforts
Loved it. Learnt a lot from this video❤
great sir ji.. i always see gap code in dp but i have no idea how it is working.. Thanks to you for such a good illustration
try seeing palindromic substring and plaindromic susseq question by sir to understand what is gap strategy
Your Explanations are just amazing
isse acha explanation ho hi nhi skta :)
in which video you have explain gap strategy ?
the tabulation way is way easier for me instead of recsurion here ,i tried 30 minutes still couldn't come up will recussrion call according to formula , but knowing the gap strategy the dp table is super easy to fill from the formula
extremely nice explanation.
brilliantly explained
Again a masterpiece Explanation Thank You, Sir
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
If you like our efforts, we request a review
g.page/Pepcoding/review?rc
You can subscribe to our channel here
ua-cam.com/users/Pepcodingabout?view_as=subscriber
Great explaination
Man...Hats OFF!! Thank You!
Excellent video.
Could you please tell me in which kind of scenarios is it necessary to use the gap strategy?
Excellent explanation. Thank you!!
Great Explanation
Amazing sir got it!!
what if opponent is also playing optimally ?
Sir how would we come to know that we have to use gap startegy?
I came to understand the question, got a life lesson also..lol
for a better experience, use the same content on nados.pepcoding.com
30:38 you are a problem solver and a good singer also :)
Brilliant!
Explaination at its best !!
Thankyou beta!
I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
amazing sir...true knowledge
Thanks for this amazing video 👍
nice explanation
thanks sir
Very nice video... Thanks❤
Glad you liked it!
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
sir jo even odd wali strategy aapne starting main btayi hai vo iss test case prr fail hai [2,4,55,6,8]
Legend coder...🙏❤
Really good explanation!!
Thank you
thank you!
sir some of your videos are not directly accessible through your website. so can you pls fix this issue and thanku so much for this great content
Will be done
how to solve this through recursion or top down approach.
Where can we learn about this gap strategy ? Awesome explanation btw :)
Will upload soon
@@Pepcoding ok thankyou sir ! 🙌🏻 will be waiting .
@@Pepcoding need gap strategy
@@Pepcoding video released sir ? about gap strategy ?
wow! best video on this topic
Glad you think so!
learn gap strategy and this amazing question💗
For better experience and precisely arranged videos.
Visit - nados.pepcoding.com and sign up to NADOS.
Don't forget to follow us on Instagram instagram.com/pepcoding/
Thankyou sir, you saved the life.
Bacha liya aaj ke interview me
Pepcoding jindabad😂
wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.
life lesson de di sir ne 4:00
Gajab kr diye app to
Thankyou beta!
I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Really Awesome Explanation....
Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Is it similar to matrix chain problem ?
Best explanation.
Keep learning, Keep growing and keep loving Pepcoding!😊
Same logic for stone game....🔥
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
Thats why i came here
hmm.This is very much like mini max algo...
And if that's the case..I think we can optimise it using alpha beta pruning.
YESSS
Magic of diagonal of traversal!
Sir, the question link in the description is not there. Thank you for the videos!
I will get that added
Sir You are awsome. I really admire you.
Sir you are great 👍👍
💓 no words to say
in which lecture sir has taught gap strategy??
For a moment I checked my WhatsApp web whether it’s mine
Great explanation like always
Anyone can tell me in which type of specific question we fill diagonal matrix..
in palindromic susbseq and substring ques , or where we need starting index ele and ending ele of a subarray or substring
very good
sir gap strategy ki konsi video hai? please reply anyone? and ye questions konsi playlist mei included hai? aapke channel mei dp ki ek hi playlist hai level 1 wali
what is a gap strategy?
Legend!!
🙏🙏
awesome explanation
Thanks buddy!
I am glad you liked it. I also hope that you are watching till the end and trying to understand the what, how, and especially why of the problem. If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc
Most awaited video sirji😂
Dekh kar btaie ki samajh aya ya nahi
@@Pepcoding sir samajh aaya lekin table mei aise ranges baanane ka idea bhi bathao mathlab table ka intuition
@@varsha4260 beta koi video dekho jisme gap strategy sikhaya ho
Sir, why the gap strategy is used. How do I know where gap strategy can be used for not
in palindromic susbseq and palindromic substring ques , or where we need starting index ele and ending ele of a subarray or substring at any point
Its similar to Minimax algorithm from Game Theory !
greate sir
Best Explanation
Glad you think so!