L5. Jump Game - II | Greedy Algorithm Playlist

Sdílet
Vložit
  • čas přidán 20. 05. 2024
  • Find problem link, notes in step 12: takeuforward.org/strivers-a2z...
    Follow me on socials: linktr.ee/takeUforward

Komentáře • 67

  • @furor4690
    @furor4690 Před 2 měsíci +49

    please bring string series as soon as possible

  • @nandiniverma5273
    @nandiniverma5273 Před 3 dny +1

    You are next level in explaining, hands up 🙌🙌

  • @Shanz-pt3fn
    @Shanz-pt3fn Před 2 měsíci +3

    Hope you are doing extremely well.

  • @AyushKumar-hi5uy
    @AyushKumar-hi5uy Před 22 dny +3

    Please try to make and upload string, stacks n queues and heaps playlist as soon as possible. I understand you must be very busy, but still you are making time for us and uploading videos and playlists at regular intervals. Thanks a lot❤❤

  • @akhilakasoju3964
    @akhilakasoju3964 Před měsícem +2

    Thank you so much💯.....please bring stacks and queue playlist

  • @raxitraju2439
    @raxitraju2439 Před měsícem +16

    I had solved this long back using 1D Dp. Just took the index as state. Below is the recurrence-
    int func(int index, vector& arr) {
    if(index >= arr.size()-1)
    return 0; //1 is already added while reaching this.
    if(index + arr[index] < arr.size() - 1)
    return INT_MAX; //impossible to reach
    int mini = 0;
    for(int i = 1; i

  • @priyanshusoni8832
    @priyanshusoni8832 Před 2 měsíci +13

    Please bring strings series ASAP bhaiya ❤ lots of love and thanks for your content ❤️🙏🏻

  • @user-lu7dx3se8o
    @user-lu7dx3se8o Před 2 měsíci +2

    please consider bringing a playlist on stacks and queues as soon as possible. I am totally unable to figure out the intuition by just seeing the question in an interview

  • @user-ni4kh7uj5h
    @user-ni4kh7uj5h Před 2 měsíci +3

    Please bring the string series as soon as possible.

  • @ritikkumarsingh5902
    @ritikkumarsingh5902 Před 2 měsíci +3

    "Striver, your DSA Sheet is absolutely phenomenal! It's been an invaluable resource for mastering data structures and algorithms. Looking forward to the remaining topics, especially the much-anticipated sections on strings and heaps. Thanks for all your hard work!"

    • @ok-jg9jb
      @ok-jg9jb Před měsícem +3

      Why are you spamming in every video?

  • @anilkumarreddy3002
    @anilkumarreddy3002 Před 2 měsíci +3

    Thankyou
    Please bring a playlist on strings

  • @Cool96267
    @Cool96267 Před 2 měsíci +2

    Thankyou so much Striver for all you efforts throughout in delivering us so much valuable content. Any student / working professional can now be able to transition their career without paying money for courses.
    Would also like your insights on the point :
    While preparing for interviews most of the aspirants are going through the videos solely and solving the question after completely watching the video. And also are feeling lazy trying to solve the question on our own. What is the best way to complete any topic without being lazy and how should an aspirant approach any topic/playlist?

  • @shwetanshusinha2690
    @shwetanshusinha2690 Před 2 měsíci

    Thank u so much for this playlist

  • @ardhidattatreyavarma5337

    Would also recommend solving Minimum Jumps problem in gfg. Same as above but with a little caveat. Amazing solution btw

  • @aeshwer
    @aeshwer Před 2 měsíci

    awesome content... please make string playlist soon

  • @aniketbharti4426
    @aniketbharti4426 Před 27 dny

    Never thought, there would be a linear solution for this question!

  • @ritik3514
    @ritik3514 Před 2 měsíci

    love your tutorials till now can you pls add string series also

  • @kavyahegde3586
    @kavyahegde3586 Před 2 měsíci +1

    Sir please do playlist in strings
    Really it is needed 🙏

  • @sksadiruddin4191
    @sksadiruddin4191 Před měsícem

    I have solved using one for loop only int jump(vector& nums) {
    int jumps = 0;
    int left = 0;
    int right = 0;
    for (int i = 0; i < nums.size() - 1; ++i) {
    right = max(right, nums.at(i) + i);
    if (left == i) {
    jumps++;
    left = right;
    }
    }
    return jumps;
    }

  • @bruvhellnah
    @bruvhellnah Před 2 měsíci +14

    Clowns in the comments demand everything but not once appreciate the guy for uploading all these lectures, lol

    • @iamnoob7593
      @iamnoob7593 Před měsícem +4

      in india if u see lot of people want everything for free.

  • @deepanshuchaudhary9299
    @deepanshuchaudhary9299 Před 2 měsíci

    Bhaiya please make a series on strings badly need it it's a humble request

  • @KKKK-pl8yf
    @KKKK-pl8yf Před 2 měsíci +4

    Can we expect Stack and Queue playlist by end of this month or next month ?

  • @KKKK-pl8yf
    @KKKK-pl8yf Před 2 měsíci

    Thanks Great Content!

  • @iamnoob7593
    @iamnoob7593 Před měsícem

    Striver brilliant solution man , I had done this problem using dp only , No wonder u r in GOOGLE

  • @jotsinghbindra8317
    @jotsinghbindra8317 Před 2 měsíci +2

    sir please fix the saved notes issue of striver sheet
    after the new update i am facing a problem that notes saved for question A gets saved to notes of question B(happens when you restart the website and go to saved notes navbar section to check your notes)

  • @cswaale4498
    @cswaale4498 Před 2 měsíci +2

    Hey raj, can you bring the string series soon???

  • @aniketbansod8136
    @aniketbansod8136 Před 2 měsíci +1

    Bhaiyya, please start heap series after this one

  • @shresthjain7557
    @shresthjain7557 Před 15 dny

    Wow ! what a solution

  • @parvahuja7618
    @parvahuja7618 Před 2 měsíci

    thankyou sir

  • @sandeepxt99
    @sandeepxt99 Před 2 měsíci

    you are best❤

  • @ayushgaurabh8604
    @ayushgaurabh8604 Před měsícem

    awesome

  • @user-fz1tl2dh9b
    @user-fz1tl2dh9b Před 2 dny

    got it bro!!!

  • @user-ug4sl4gf2x
    @user-ug4sl4gf2x Před 23 dny

    Understood 💯

  • @KartikeyTT
    @KartikeyTT Před 28 dny

    ty sir

  • @hautran7559
    @hautran7559 Před 2 měsíci

    love it

  • @hajeeramohamad7641
    @hajeeramohamad7641 Před měsícem

    Isn't that i+arr[i] inside the for loop? Why striver has written i+arr[ind]? Won't that be different?

  • @MayankPareek
    @MayankPareek Před 2 měsíci

    Bhaiya pattern wise recursion prr bhi daal do

  • @Rahul_Mongia
    @Rahul_Mongia Před měsícem +1

    class Solution {
    public int jump(int[] nums) {
    if (nums.length == 1) return 0;

    int n = nums.length;
    int l = 0, r = 0, jumps = 0, farthest = 0;
    while (r

  • @Professor-du2pf
    @Professor-du2pf Před měsícem

    Understood

  • @devanshshroff1820
    @devanshshroff1820 Před 2 měsíci

    Started your playlist a week ago, didn't know there are more videos in the making. What else is remaining in the course?

    • @brainmosquito7
      @brainmosquito7 Před 14 dny

      all major portions are covered strings is just remaining i recommend you to go to TUF wesite and start following A2Z sheet

  • @deepanshu7295
    @deepanshu7295 Před 2 měsíci +1

    Bhaiya please start sde sheet challange 2024

  • @samitkumar18
    @samitkumar18 Před 2 měsíci

    String please

  • @ANONYMOUS-xj1kd
    @ANONYMOUS-xj1kd Před měsícem +1

    hey striver here in my O(n) time complexity solution
    int jump(vector& nums) {
    int final=nums.size()-1;
    int i=0;
    int count=0;
    while(final!=0){
    if(nums[i]>=final-i){
    final=i;
    count++;
    i=0;
    }
    else i++;
    }
    return count;
    }

  • @worldfromhome4033
    @worldfromhome4033 Před 20 dny

    Best!

  • @Flash-qr5oh
    @Flash-qr5oh Před měsícem +1

    HOW IS IT 2 JUMPS FOR ALL INDEXES FROM F(1,1) IN TREE @3:09 ?

  • @sagarsm23
    @sagarsm23 Před 2 měsíci +1

    Why code studio is gone

  • @prerakunhale50
    @prerakunhale50 Před 2 měsíci +2

    please bring the string video first .A humble request from us

  • @thoughtsofkrishna8963
    @thoughtsofkrishna8963 Před 25 dny

    Waiting for strings playlist

  • @prateek4279
    @prateek4279 Před měsícem

    was the greedy solution intuitive or not ?coz i dont find it intuitive!!!!

  • @sujalsinha240
    @sujalsinha240 Před 3 dny

    Please bring heaps bro

  • @ManishKumar-dk8hl
    @ManishKumar-dk8hl Před 2 měsíci

    yehi too chahiye tha 😭

  • @chiragsharma8905
    @chiragsharma8905 Před měsícem

    Striver, there is no need for 2D DP here. It can be solved using 1D DP.

  • @surbhigupta5777
    @surbhigupta5777 Před měsícem

    US

  • @Ybash2979
    @Ybash2979 Před měsícem

    brother ye toh DP ka question hai then put it there why in greedy playlist :)

    • @Rahul_Mongia
      @Rahul_Mongia Před měsícem

      question has different ways to solve, this soln has greedy as optimal approach

  • @prateek4279
    @prateek4279 Před měsícem

    the dp solution is 1d why use 2d:class Solution {
    public:
    int solve(vector& nums,int id,vector& dp){
    if(id>=nums.size()-1)return 0;
    if(dp[id]!=-1)return dp[id];
    int reach=id+nums[id];
    int n=nums.size();
    int mini=1e9;
    for(int k=id+1;k

  • @NitinSharma-bk7dw
    @NitinSharma-bk7dw Před měsícem

    There can one more simple greedy solution
    #Java
    class Solution {
    public int jump(int[] nums) {
    int z;
    int smallest[]=new int[nums.length];
    smallest[nums.length-1]=0;
    for(int i=nums.length-2;i>=0;i--){
    if(i+nums[i]>=nums.length-1)
    smallest[i]=1;
    else{
    z=getsmallest(smallest, i+1, i+nums[i]);
    smallest[i]=1+z;
    }
    }
    return smallest[0];
    }
    int getsmallest(int ary[], int a, int b){
    int small=10000000;
    for(int j=a;j

  • @084abhigna_y8
    @084abhigna_y8 Před 2 měsíci +1

    Data Structures & Algorithm ❌
    Data STRIVERS & Algorithm ✅

  • @aggarwalsachin4854
    @aggarwalsachin4854 Před měsícem

    bro, why is your voice very low in this greedy series, can't here u properly

  • @sumitmishra9795
    @sumitmishra9795 Před měsícem +3

    00:04 Finding minimum number of jumps to reach the end
    02:01 Using recursion to find the minimum number of jumps in a smaller example
    04:04 Return the number of jumps when index is greater than or equal to n - 1
    06:19 Optimizing dynamic programming solution using a quadratic state approach
    08:37 Understanding jump range in the context of Greedy Algorithm
    10:31 Optimizing jump game II algorithm by carrying a range instead of individual recursive calls
    12:42 Determine farthest jump for each range and update jumps array
    14:47 Implementing non-recursive range based solution for jump game with linear time complexity.