I need your support, and you can do that by giving me a like, and commenting "understood" if I was able to explain you.
@ManishKumar-ui1tf2 жыл бұрын
Please Upload the next One video
@dhrubajyoti37742 жыл бұрын
Understood 🥺🥺
@somyadebsarkar65932 жыл бұрын
Can't we start from 0 and using recursion ?
@shubhamjha57382 жыл бұрын
koi compiler theek krao yrr python vla coding ninjas ka
@vishalkumarshaw92082 жыл бұрын
We are with u.
@KaushalDhruw5 ай бұрын
2 years later. Still the ultimate and unbeatable learning resource in the market.
@salmanpandey81503 ай бұрын
But i thought adita verma was best for dp
@riyasinghal2671Ай бұрын
@@salmanpandey8150yrr usne to mujko kisi pe bhi recursion karna bata diya bina soche uska base case nikap deta hun
@sanketdas70002 жыл бұрын
The dp series is like web series. Every day a new episod is coming with lots of new things and leaving a suspence for the next one.. thank you striver for this wonderful effort..and "UNDERSTOOD"..
@skiver97632 жыл бұрын
only if we could get a trailer for the next day's video😂
@jayantmishra6897 Жыл бұрын
this is the only playlist on youtube where you will find only positive comments because this man really put his effort to make this playlist valuable. thank you so much striver.
@manikantadevadiga7146 Жыл бұрын
i can see 2, striver and love babbar
@jeet-smokey3 ай бұрын
@@manikantadevadiga7146 Love Babbar copies from striver. I have seen many videos taking the same sample code and examples from striver.
@nitpBlogs2 ай бұрын
@@manikantadevadiga7146 Aditya Verma ka bhi dekh lo.
@haseebshaik866920 күн бұрын
After searching all over the world to grasp these DSA concepts, it wasn't until I watched this video that everything finally clicked. The way you explained it was beyond exceptional-thank you for creating such a clear and impactful resource!
@adarshanku79882 жыл бұрын
This series is so damn good that before watching this video, i thought of giving "min cost climbing stairs" question on leetcode a try because i felt i could do that. That is similar to this question only. And boom, i solved that question in all possible ways...recursion, memoization, tabulation and space optimised method. Thank you striver. You have kinda opened our brain and made our thinking broader. Thank you so much for the inspiration you are. Love you !!!
@parthsalat2 жыл бұрын
Recursion code at 24:33 Memoization code at 25:25 Tabulation code at 30:54 Space optimization at 36:22
@prateeksaini85532 жыл бұрын
Thanks dude
@yournemesis82322 жыл бұрын
Would recommend to watch completely without skipping though The insights given by him are great
@parthsalat2 жыл бұрын
@@yournemesis8232 Yes, you are right. This is just for jumping to the desired explanation without wasting time - when you are revising
@026harshagarwal92 жыл бұрын
We will take a for loop running from j=1 to k and instead of writing (ind-1) and (ind-2) we will going to simply write (ind-j) that will give me the solution. Time Complexity:-O(N*K) Space complexity:-O(N). Yes sir, it cannot be space optimised because we have to use K+1 variables . Nice video and yes you are absolutely right, I have learnt space optimisation in dp from you THANKS MAN 👍👍
@cipherCrafters142 жыл бұрын
baniya buddhi mat chalao jyada striver bhai ko appreciate kaaro khud toh kuch kar nahi raahe
@Anonymous-lw4nq Жыл бұрын
@@cipherCrafters14 XD
@SayanKarmakarАй бұрын
Learnt the concept, went straight to the editor, coded it in JAVA and submitted it...All test cases submitted 🔥👍 Striver's way of explaining recursion and DP is unbeatable and uncomparable
@sumitsanu9524 Жыл бұрын
You will get hired even if you can explain an interviewer till memoization thing but it will blow the mind of interviewer if you go till space optimisation to constant.... awesome video and striver is just god.
@balajiaadi19012 жыл бұрын
I recently started this dp series and i want to complete this series in 20 days this is my day 1 Thank you for this awesome series
@niyammuliya57872 жыл бұрын
follow ups solution: #include int frogJump(int n, vector &heights, int k){ vector dp(n, INT_MAX); dp[0] = 0; for(int i=1; i
@letslearn1055 Жыл бұрын
this is what i thought in the very first second.
@kanishyathra Жыл бұрын
@@letslearn1055 me too
@user-id7pz9bs2f10 ай бұрын
@@letslearn1055 same here when he said k jumps then i thought of a nested for loop till k
@uditgarg65085 ай бұрын
mee too
@SuperSaber92 жыл бұрын
Amazing video! Do watch till the end because in the space optimization part, the actual value of watching the past two videos comes.
@manideep71484 күн бұрын
I did not see this series feeling that DP is soo tough but after listening to your explanation, I've changed my mind. All credits to you Striver !
@Harmless_creature7 күн бұрын
00:03 Find the minimum total energy used by the frog to reach the first stair 02:13 The minimum energy required to jump from one point to another is 20. 06:11 Recursion is a way to find the path with minimum energy. 08:30 The costing for this guy will be zero no matter what you do. 12:51 Applying memoization to optimize recursion 14:47 Return the minimum of the left and right subpoints 18:51 Recursion helps solve multiple sub problems by reusing previously solved solutions. 20:50 Convert a recursion solution to dynamic programming 24:48 Memoization and tabulation are two approaches to solve problems recursively and iteratively respectively. 26:43 The first step in tabulation is to initialize the dp array. 30:55 The space complexity can be optimized by using the index minus 1 and index minus 2 technique 32:49 Use variables instead of an array to store previous values. 36:49 The problem requires k jumps as a follow-up to i plus 1 and i plus 2. 38:38 The ultimate resource for placements
@PujaKumari-zl7rw2 жыл бұрын
Understood, Honestly this is the very first time I am trying to learn any dp problem. And I am able to understand everything... Very clear explanation. Loved it.. Thanks a lot for all the efforts :)
@taukirlalwala28652 жыл бұрын
Hey Striver! I tried solving this question myself and I was able to solve it, I must say this series is amazing. You started building my concepts in first 2 lectures itself. Gonna see your lecture now and look at your approach. Would surely complete whole dp series. Thank you for this series ❤
@firefly_3141 Жыл бұрын
Code Of Frog Jump #include using namespace std; //Top-Down Approach int dp1(int ind,vector&heights,vector&dp) { if(ind == 0) return 0; if(dp[ind] != -1) return dp[ind]; int left = dp1(ind-1,heights,dp) + abs(heights[ind]-heights[ind-1]); int right = INT_MAX; if(ind > 1) right = dp1(ind-2,heights,dp) + abs(heights[ind]-heights[ind-2]); return dp[ind] = min(left,right); } //Tabulation Method - Bottom Up Approach /* vectordp(n,0); dp[0]=0; for(int i=1;i 1) secondstep = dp[i-2] + abs(heights[i] - heights[i-2]); dp[i] = min(firststep,secondstep); } return dp[n-1]; */ //Space Optimization /* int prev=0; int prev2=0; for(int i=1;i1) secondstep = prev2+abs(heights[i]-heights[i-2]); int curi = min(firststep,secondstep); prev2 = prev; prev = curi; } return prev; */ int frogJump(int n, vector &heights) { vectordp(n+1,-1); return dp1(n-1,heights,dp); }
@adebisisheriff1598 ай бұрын
Thanks so much Striver. We really appreciate your effort. You are a rare gem.
@studynewthings172711 ай бұрын
The code for k jumps: #Memoization def k_jumps(n,dp,arr,k,result): if n == 0: return 0 if dp[n] != -1: return dp[n] for i in range(1,k+1): if (n > (i - 1)): step = k_jumps(n-i,dp,arr,k,result) + abs(arr[n] - arr[n-i]) else: step = 9999999 result = min(result,step) dp[n] = result return dp[n] arr = [30,10,60,10,60,50] n = len(arr) k = 3 result = 999999 dp = [-1 for i in range(n)] print(k_jumps(n-1,dp,arr,k,result)) #Tabulation def k_jumps(n,arr,k): dp = [-1 for i in range(n)] if n == 0: return 0 dp[0] = 0 for index in range(1,n): result = 999999 for i in range(1,k+1): if (index > (i - 1)): step = dp[index-i] + abs(arr[index] - arr[index-i]) else: step = 9999999 result = min(result,step) dp[index] = result print(dp) return dp[n-1] arr = [60,30,10,60,10,60,50] n = len(arr) k = 3 result = 999999 print(k_jumps(n,arr,k))
@ankitadas58332 жыл бұрын
Amazing video! Everything is clearly understandable. from day 1 of dp series I have watching your videos and Day by Day become big fan of your teaching way. God bless you sir. Came to know from your insta story that u have fever 🤒 Get well soon sir.
@pjagannadham25402 жыл бұрын
Yes his teaching is absolutely marvelous and I become big fan of him he keep rocking now I am happy to be cse student 😇😇
@alisharath16110 ай бұрын
Best video I have ever seen on DP. Thank you Striver for helping out fellow developers.
@popularedits69842 жыл бұрын
UNDERSTOOD , Now I am loving dp its become easy to think from recursion to tabulation step by step, thank you so much for the hardwork!
@vibhorbhatt307611 күн бұрын
This question became a piece of cake for the one's following previous vedios. Thankyou Striver Bhaiya.
@ryanmathew639710 ай бұрын
your explanation is so good that even before you write the pseudo code, i was able to write the recursion by starting from 0 to n-1 rather than the reverse approach that you have taken in the video. Great Work you are doing. Helps to improve the way a person can solve a problem.
@tanishkumar6682 Жыл бұрын
Hey, striver i just want to say that concept in your videos are such a crystal clear and easy to understand that even i am studying for the first time i do not feel any difficulty to understand the solutions. so, thank you so much for providing such a video lecture free on youtube
@arghyadeepbhowmick2248 Жыл бұрын
Understood!! After seeing the recursion, I was able to convert it on my own into a dp. Thank you STRIVER. ❤
@xlr8tanmay2 ай бұрын
You need to learn Recursion bro
@pranavkutty57362 жыл бұрын
Understood! Your series is making me love DP. Thanks a ton! Excited for the next one.
@ragnos6756 Жыл бұрын
Approach: Since the frog can make k jumps, we can use k recursive calls and find the minimum of them. used a variable ans to kept it as positive infinity to update the answer . base case is same as the frog jumps qn. but since frog can make k jumps, used a for loop to find the the answer for every jump (1st , 2nd ,.... till kth). also a check of i-w>=0 is made so that there is no infinite recursion. def frogJump(n,heights,k) -> int: i=n-1 ans=float('inf') def helper(i,ans): if i==0: return 0 for w in range(1,k+1): if i-w>=0: find=helper(i-w,ans)+abs(heights[i-w]-heights[i]) ans=min(find,ans) return ans return helper(i,ans) def frogjump_tabulation(n,heights,k): dp=[0]*(n+1) dp[0]=0 for i in range(1,n): ans=float('inf') for j in range(1,k+1): if i-j>=0: find=dp[i-j]+abs(heights[i-j]-heights[i]) ans=min(ans,find) dp[i]=ans return dp[n-1]
@dEviL_bIsWaJiTАй бұрын
Understood, Thanks a lot bhaiya ❤
@gmh14 Жыл бұрын
At 25:23, can't you initialize the dp array for only n elements instead of n+1? Like you did for tabulation?
@nikhilprasad6442 жыл бұрын
"UNDERSTOOD"..... Bhaiya pls upload practice problem link other than coding ninja link. Leetcode interface is best for easy understanding. I hope you understand , Thanks
@krishnachaitanya12652 жыл бұрын
Its not there on leetcode(Same problem)
@krishnachaitanya12652 жыл бұрын
Sadly leetcode is missing these kind of problems. No platform can match leetcode interface
@zaidshaikh25362 жыл бұрын
A similar problem on Leetcode is Min cost Climbing stairs 746
@nikhilprasad6442 жыл бұрын
@@zaidshaikh2536 bro i didnt ask for a similar problem on leetcode, I asked Striver bro to give the leetcode link and not the coding ninja link.
@simple_saviour44962 жыл бұрын
If possible pls provide leetcode problem link also of the particular problem since most of us are following leetcode
@zaidshaikh25362 жыл бұрын
Similar problem on Leetcode is 746
@Cartooz0111Ай бұрын
this is the only playlist on youtube where you will find only positive comments because this man really put his effort to make this playlist valuable. thank you so much striver. ❤❤From Gujarat !! Jordar (Gujarati)!
@ArjunSehgal-gv1cc6 ай бұрын
semester 1 is about to start,and i am on this lecture,super confident>3000
@albatrossgeez66376 ай бұрын
bhai itna jaldi
@gajjalaharsha2 жыл бұрын
Can we write base case for n=1, then can write Math.abs(heights[1]-heights[0])?
@takeUforward2 жыл бұрын
Yes
@Vishal-joshi19982 жыл бұрын
Count all possible palindrome in string with rearranging characters - Infosys 🙄
@SumitChauhan-vv5ix6 ай бұрын
This can be solve using combinatrix also , right??😅
@anukritigarg3039Ай бұрын
Understood!! I was always scared of Dynamic Programming but you made it so easy 🔥
@vibhavsharma27244 ай бұрын
understood this very well. Thanks to striver
@harshithaharshitha792720 күн бұрын
your intention is to make education easier...yes!! striver you did it....We learn from you.We will make you proud a Day...thankyou striver for this wonderful series..this is first comment on my youtube..try to ping my comment if u have time ❤
@parvathivanapilli85726 ай бұрын
Understood, Now I'm loving Dp Thank you Striver ❤
@satwiksrivastavaАй бұрын
I managed to do the space optimization on my own! That's just how good your explanation is!
@rohan87584 ай бұрын
understood. Thanks for DP web series with addiction
@athangkulkarni82458 ай бұрын
Understood! Also, I could do tabulation and space optimization on my own after watching the explanation! A very big Thank you🥺
@stith_pragya8 ай бұрын
UNDERSTOOD...........😎😎😎😎😎😎
@joyassroybarua5861Ай бұрын
Thank you vai. Its really awesome. And love from Bangladesh
@user-xx4mc1ve5l8 ай бұрын
Take the base case of index == 1 as return abs(heights[1]-heights[0]), makes the code a bit simpler without if else conditions.
@user-xx4mc1ve5l8 ай бұрын
index == 0 condition stays as it is so basically two base cases
@monisavaratharajАй бұрын
US striver! TUF always takes us forward...No one can beat striver in explaining the problem
@stith_pragya8 ай бұрын
Thank You Much for this wonderful video.............🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@chandolumanishbabu6807 Жыл бұрын
Frog jump with k jumps: #include using namespace std; int min_dp(int n, vector &heights, int ind, vector &dp,int k) { if (ind == 0) return dp[0]=0; if (ind == 1) return dp[1] = abs(heights[ind] - heights[ind - 1]); if (dp[ind] == -1) { vector temp(k); for(int i=1 ; i> n>>k; vector heights(n); for (int i = 0; i < n; i++) { cin >> heights[i]; } int ind = n-1; vector dp(n + 1, -1); cout> t; while (t--) { solve(); } return 0; }
@NirmalyaMusicOfficialАй бұрын
Understood each step in detail 💯
@AjaySingh-ty2wm8 ай бұрын
JavaScript/ typescript all 4 ways // simple recursion function f(ind: number, heights: number[]): number { if (ind == heights.length - 1) return 0; let left = f(ind - 1, heights) + Math.abs(heights[ind] - heights[ind - 1]); let right = Infinity; if (ind > 1) right = f(ind - 2, heights) + Math.abs(heights[ind] - heights[ind - 2]); return Math.min(left, right); } // recusion with memoization function memoF(ind: number, heights: number[], dp: number[]): number { if (ind == heights.length - 1) return 0; if (dp[ind] != -1) return dp[ind]; let left = memoF(ind - 1, heights, dp) + Math.abs(heights[ind] - heights[ind - 1]); let right = Infinity; if (ind > 1) right = memoF(ind - 2, heights, dp) + Math.abs(heights[ind] - heights[ind - 2]); return dp[ind] = Math.min(left, right); } // tabulation function TabulationFrogJump(n: number, heights: number[]): number { let dp = new Array(n + 1).fill(0); dp[0] = 0; dp[1] = Math.abs(heights[1] - heights[0]); for (let i = 2; i 1) right = dp[i - 2] + Math.abs(heights[i] - heights[i - 2]); dp[i] = Math.min(left, right); } return dp[n]; } // space optimised tabulation function SpaceOptimisedTabulationFrogJump(n: number, heights: number[]): number { let prev1 = 0; let prev2 = Math.abs(heights[1] - heights[0]); for (let i = 2; i
@SoyaibZihad108 ай бұрын
I am nothing but greatful. Wanna finish the whole playlist. Thanks a lot
@xlr8tanmay2 ай бұрын
Amazing explanation. Perfect solution to explain in an interview..
@bhanderidhruvbhanderidhruv5574 ай бұрын
big thank you bhai for your hard work and make questions easy for us , again thank you with saying "we can't be lazy by seeing your high level of energy to teach us", "UNDERSTAND" 😍🥰🤩😇😘❤💘
@prabhakaran55427 ай бұрын
Understood ❤
@SethuIyer955 ай бұрын
I am actually watching this to give a google interview sometime later but god damn, this is actually fun to learn lol
@studynewthings172711 ай бұрын
time complexity and space complexity of memoization, 22:20
@keyurchaudhari94 Жыл бұрын
K jumps code: int memomization(int index,vector &h) { vector dp(index+1,0); int fs=0;int ss=INT_MAX; for(int i=1;i=0) ss=dp[i-k-1]+abs(h[i-k-1]-h[i]); smallest=min(smallest,min(fs,ss)); dp[i]=smallest; } } } return dp[index-1]; }
@user-th4nl8rv7l3 ай бұрын
Bro the way u explained is just amazing
@mayank_singh_43 Жыл бұрын
I also started understanding dsa , you are magical man of programming world✌
@urdaddy852011 ай бұрын
this space optimization technique is way too classic, thanks bhaiya
@ADITYASINGH-b4uАй бұрын
understood every bit of content ...thank u for this amazing lecture
@lokeshreddy41487 ай бұрын
I think it is the best solution to previous videos
@codewithom11 Жыл бұрын
US😎 Before the lecture, i was having a lot of fear about tabulation. Bt now its totally clear.😇 Thanks Raj Bhaiyya
@harshrajhrj Жыл бұрын
Very helpful and minute problems were explained nicely. Nothing best than this.
@thisismr900 Жыл бұрын
Understood! hauuwa bana rakha tha dp ka 1 saal se man mein thanks 900
@jayujain2647 Жыл бұрын
Thanks a lot!!!! I was able to solve the video without seeing the video all because of you!!!!
@vanshbaghel5884 Жыл бұрын
Regular Recursion using java: public static int frogJump(int n, int heights[]) { return dpRecursion(n - 1, heights); } private static int dpRecursion(int n, int[] heights) { if (n == 0) return 0; int left = dpRecursion(n - 1, heights) + Math.abs(heights[n] - heights[n - 1]); int right = n > 1 ? dpRecursion(n - 2, heights) + Math.abs(heights[n] - heights[n - 2]) : Integer.MAX_VALUE; return Math.min(left, right); }
@manasansh719811 ай бұрын
"UNDERSTOOD" Great series Striver
@user-to3jj8lj8hАй бұрын
Understood ! much appreciations to your efforts .
@abytespaceneeded8 ай бұрын
Solution for Frog Jump: #include #include #include #include using namespace std; // recursion // Time Complexity: O(2^N) // Space Complexity: O(N) - stack space int helper(vector& nums, int index) { if(index == 0) return 0; int step1 = abs(nums[index] - nums[index-1]) + helper(nums, index-1); int step2 = INT_MAX; if(index - 2 >= 0) { step2 = abs(nums[index] - nums[index-2]) + helper(nums, index-2); } return min(step1, step2); } int forgJump(vector& nums) { int size = nums.size(); return helper(nums, size-1); } // memoization // Time Complexity: O(N) // Space Complexity: O(N) + O(N) - stack space int helper(vector& nums, int index, vector& dp) { if(index == 0) return 0; if(dp[index] != -1) return dp[index]; int step1 = abs(nums[index] - nums[index-1]) + helper(nums, index-1, dp); int step2 = INT_MAX; if(index - 2 >= 0) { step2 = abs(nums[index] - nums[index-2]) + helper(nums, index-2, dp); } return dp[index] = min(step1, step2); } int forgJump(vector& nums) { int size = nums.size(); vector dp(size, -1); return helper(nums, size-1, dp); } // Tabulation // Time Complexity: O(N) // Space Complexity: O(N) int forgJump(vector& nums) { int size = nums.size(); vector dp(size, 0); dp[0] = 0; for(int i=1;i= 0) { step2 = abs(nums[i] - nums[i-2]) + dp[i-2]; } dp[i] = min(step1, step2); } return dp[size-1]; } // Space Optimized // Time Complexity: O(N) // Space Complexity: O(1) int forgJump(vector& nums) { int size = nums.size(); int prev = 0, secondPrev = 0; for(int i=1;i= 0) { step2 = abs(nums[i] - nums[i-2]) + secondPrev; } int curr = min(step1, step2); secondPrev = prev; prev = curr; } return prev; }
@abhisheknemade24448 ай бұрын
Thanks baiya very wonderfull video. I understood the video. Please make more and more videos. God will bless you. HK.
@umber31178 ай бұрын
Understood. Amazing explanation. Thanks a lot for making these videos.
@lifehustlers1645 ай бұрын
4/57 done!!! understood!
@ajayprajapati791410 ай бұрын
Explanation is very high level❤❤❤
@LowkeyCoder9 ай бұрын
"understood" i came here with a doubt that i am from java if i will be able to understand or not but what happened i understood as fine as i can and i can write the same in c++ with little bit of help oviously but thanks a lot !
@MrVishalSharmahАй бұрын
Code for K jumps : int f(int idx, int k, vector &heights, vector &dp) { if (idx == 0) { return 0; } if (dp[idx] != -1) { return dp[idx]; } int minCost = INT_MAX; for (int i = 1; i = 0) { int jumpCost = f(idx - i, k, heights, dp) + abs(heights[idx] - heights[idx - i]); minCost = min(minCost, jumpCost); } } return dp[idx] = minCost; } int frogJump(int n, int k, vector &heights) { vector dp(n + 1, -1); return f(n - 1, k, heights, dp); }
@user-bw7gb1yr1p11 ай бұрын
yeah, Sir, I understood. your lecture is very informative..... thank you, sir.
@ashj11658 күн бұрын
understood; possibly wont have to watch this topic again :)
@vikrammehra43543 ай бұрын
thanku striver bhaiya
@MDEMANURRAHAMAN-4 ай бұрын
Best explanations indeed, love you man.
@sonukumarram18807 ай бұрын
US , such a cool explanation ... thnx for this wndrful playlist
@ashusnapx Жыл бұрын
#include int frogJump(int n, vector &heights) { if(n == 0) return n; int left = frogJump(n-1,heights) + abs(heights[n] - heights[n-1]); int right; if(n > 1) { right = frogJump(n-2,heights) + abs(heights[n] - heights[n-2]); } return min(left,right); } whats wrong?
@sankalpsamitkumarpatel429 Жыл бұрын
declare right = MAX_INT.
@dibyajyotinayak223510 ай бұрын
Understood! Thanks for explaining beautifully!
@jaatharsh Жыл бұрын
awesome, loved the clear n cripsh explanation
@aasifali9139 Жыл бұрын
Thx for this video striver bhaiya. ***Understood***
@nagame859 Жыл бұрын
Understood! Just wow! Love DP ❤️
@G.Lakshmi_Prasanna Жыл бұрын
Clearly understood💯. Thank you so much for the series
@vijeshsshetty2 ай бұрын
Understood. Great Playlist !!!!
@rajarshinath619410 ай бұрын
understood Sir... U are just GOD
@vm1662 Жыл бұрын
Understood!! Thanks a lot for creating this series.
@aagamjain2131 Жыл бұрын
This playlist is worth the hype ❤🔥
@UECAshutoshKumar Жыл бұрын
Thank you sir Understood
@20arpitbhatnagarit7 Жыл бұрын
Instead of if clause sir you could have inserted the val of dp[1] and started loop from i = 2
@user-zm9qn2sp3h11 ай бұрын
UNDERSTOOD. Your explanation is damn good bro. thanks alot.❤
@Happy-tf7se4 ай бұрын
As I am declaring the dp array globally it is giving incorrect answer. What could be the reason?? vector dp(100000,INT_MAX); int solve(int ind, vector& height){ if(ind==0) return 0; if(dp[ind]!=INT_MAX) return dp[ind]; int jumpTwo = INT_MAX; int jumpOne= solve(ind-1, height)+ abs(height[ind]-height[ind-1]); if(ind>1) jumpTwo = solve(ind-2, height)+ abs(height[ind]-height[ind-2]); return dp[ind]=min(jumpOne, jumpTwo); } int frogJump(int n, vector &heights) { // Write your code here. return solve(n-1,heights); }