Climbing Stairs with Minimum Moves | Dynamic Programming Problem Explained

Sdílet
Vložit
  • čas přidán 28. 07. 2020
  • 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 solution of the Climb Stair in Minimum Moves problem where we are required to move from the ground level to the highest level with variable jumps and minimum move. In this problem,
    1. You are given a number n, representing the number of stairs in a staircase.
    2. You are on the 0th step and are required to climb to the top.
    3. You are given n numbers, where ith element's value represents - till how far from the step you could jump to in a single move. You can of course jump fewer number of steps in the move.
    4. You are required to print the number of minimum moves in which you can reach the top of staircase.
    Note - If there is no path through the staircase print null.
    #dp #dynamicprogramming #climbstairs
    For a better experience and more exercises, VISIT: www.pepcoding.com/resources/o...
    Have a look at our result: www.pepcoding.com/placements
    Follow us on our FB page: / pepcoding
    Follow us on Instagram: / pepcoding
    Follow us on LinkedIn: / pepcoding-education

Komentáře • 165

  • @soumadeepsarkar1272
    @soumadeepsarkar1272 Před 3 lety +46

    This playlist on DP deserves more views than any other Dp video on YT!! Loved your teaching. I wish I could get a teacher like u.

    • @Pepcoding
      @Pepcoding  Před 3 lety +11

      Thanks buddy!
      It's all bcz of the love and respect which I get from you people which 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😊

  • @vishalsachan3387
    @vishalsachan3387 Před 3 lety +4

    Sir aap insaan ho yaa bhagwaan!!!
    Literally u r great sir...
    Just loved ur teaching... everything becomes crystal clear ....

  • @itz_me_imraan02
    @itz_me_imraan02 Před 3 lety +2

    This man makes logic easy 🔥

  • @Rahul0508-n9m
    @Rahul0508-n9m Před 2 lety +2

    Video is end, wait wait pause it,
    i'll have to like this video first
    My mind always says to me after watching each and every of your videos.
    Thanks for sharing

    • @Pepcoding
      @Pepcoding  Před 2 lety +1

      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities

  • @abhinandankumar6501
    @abhinandankumar6501 Před 2 lety

    Tabulation ke 3 niyam.....aur DP khatam...Awesome Explaination.

  • @pravinmudaliyar3421
    @pravinmudaliyar3421 Před 2 lety +3

    Actually, we don't need Integer[]. We can get the desired solution with primitive int[]. Memoized and simplified tabulation approach: public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for(int i=0; i arr.length || arr[curr] == 0){
    return Integer.MAX_VALUE - 1;
    }
    if(dp[curr] != 0){
    return dp[curr];
    }
    int minWays = Integer.MAX_VALUE - 1;
    for(int i=1; i=0; i--){
    int jumps = arr[i];
    int min = Integer.MAX_VALUE - 1;
    for(int j=1; j

    • @youtubejk2023
      @youtubejk2023 Před 2 lety

      What resources are you referring to learn DP?

  • @rajeshagarwal3238
    @rajeshagarwal3238 Před 3 lety +1

    Great sir 👌

  • @sakshamsrivastava6280
    @sakshamsrivastava6280 Před 3 lety

    Thanks sir for the beutiful explaination

  • @TheShantanu1395
    @TheShantanu1395 Před 2 lety +1

    Memes within the content are just 🔥🔥🔥

  • @Wreker_
    @Wreker_ Před 3 lety +3

    There is a reason why there are no dislikes here , great explanation sir :)

    • @Pepcoding
      @Pepcoding  Před 3 lety

      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
      czcams.com/users/Pepcodingabout?view_as=subscriber

    • @Wreker_
      @Wreker_ Před 3 lety

      @@Pepcoding sir pichle saal hi de diye the 5 star agar pandemic nahi hota to mein live padh rha hota 😂

  • @goodpeople7615
    @goodpeople7615 Před 4 lety +14

    Sir your recursion playlist was by far the best .Hope you will complete the DP one also :-)

    • @Pepcoding
      @Pepcoding  Před 4 lety +4

      Ofcourse we will. Have recorded 4 questions since morning, will come soon.

  • @ashokdurunde1814
    @ashokdurunde1814 Před 3 lety +1

    VERY NICE EXPLANATION SIR
    I WERE LATE BY 1YR

  • @shiningwizard321
    @shiningwizard321 Před 2 lety +2

    Hi Sumeet sir! Love your videos, I've been going through all of your playlists on DSA, and you make it so easy! I just have one feedback, I think you should also mention the complexities of your solutions, since that's asked in almost every DSA interviews.

    • @Pepcoding
      @Pepcoding  Před 2 lety +2

      Surely we will focus on this. Thanks for your valuable feedback, For best experience visit on nados.pepcoding.com

  • @rishabhgoyal2835
    @rishabhgoyal2835 Před 3 lety

    best .. mazza aagya

  • @mangeshgupta5677
    @mangeshgupta5677 Před 3 lety +3

    Loved your teaching style, best channel , editing videos to make some fun really appreciate your efforts 😊

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      yahi to chaie
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber
      For clearing your doubts, you can join our community on telegram
      t.me/pepcoding

    • @mangeshgupta5677
      @mangeshgupta5677 Před 3 lety

      @@Pepcoding Done 🥳🙏

  • @sewalal9450
    @sewalal9450 Před 4 lety +1

    Amazing sir

  • @Abhishek-hg9ql
    @Abhishek-hg9ql Před 4 lety +4

    Sumeet Sir, I Am Continually Learning From Your Java Foundation Very Seriously, In Future Sir, I Eagerly Want To Join Pepcoding In FUTURE.
    I Enrolled In Other Institute Then I Came To Know About PepCoding.
    I Want To Get Connected To PepCoding.

    • @Pepcoding
      @Pepcoding  Před 4 lety +1

      Always welcome. You can contact us on 01140194461

  • @kritikasharma3331
    @kritikasharma3331 Před 2 lety

    amazing explanation sir :)

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad you liked it!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @divyamgupta6415
    @divyamgupta6415 Před 3 lety

    samajh mein aaya sir .

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Keep learning and keep growing!

  • @willingtushar
    @willingtushar Před 3 lety +1

    7:11 to understand it, find the min of (number of jumps after your jump) + 1.
    Here, from 9, Min of(0, out_of_index) +1 = 1

    • @sauravdas7591
      @sauravdas7591 Před 2 lety

      why is it +1 ? can anyone explain

    • @koushikbiswas8289
      @koushikbiswas8289 Před 2 lety

      @@sauravdas7591 you have three step, source, middle, destination.
      From middle to destination, min no of moves calculating by Solving min().
      Now from source to middle, you can go with 1 step.
      So total step required to go destination from source= 1+ intermediate steps.
      See the diagram you will cleared.

  • @ranveersingh4961
    @ranveersingh4961 Před 3 lety +1

    clap for this but plzz solve this using recursion too

  • @prashanttiwari120
    @prashanttiwari120 Před rokem

    BEHTEREEN DP LIST 😍❤

  • @lakshayrastogi2347
    @lakshayrastogi2347 Před 3 lety

    Sumeet sir op!..waiting for offline classes

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thank you keep motivating, keep learning and keep loving Pepcoding😊

  • @jagritijain6874
    @jagritijain6874 Před rokem

    I understood this problem, thanks so much Sir, but abhi pichhle wale questions se confusion hone lagi hai. Kya karna chahiye ?

  • @sarthaknikhal5540
    @sarthaknikhal5540 Před 3 lety

    Sir, does this mean Integer takes more space than int?

  • @PriteshRanjan30
    @PriteshRanjan30 Před 2 lety +1

    please explain O(n) solution.

  • @lucario4399
    @lucario4399 Před 3 lety +5

    i understood this algorithm at 2nd index 😂

  • @JupyTerGaming
    @JupyTerGaming Před 2 lety

    will this code will work if last element is 0 of array...?

  • @ankitraj-gz5eu
    @ankitraj-gz5eu Před rokem +1

    Hello sir...
    This code is not working for input N=10
    [2,3,1,1,2,4,2,0,1,1]. Please
    right ans is 4 but compiled ans is 4.Please look into this

  • @theuntoldtree
    @theuntoldtree Před 3 lety

    Again tq

    • @Pepcoding
      @Pepcoding  Před 3 lety

      So Nice of you keep motivating, keep learning and keep loving Pepcoding😊

  • @RiteshKumar-nt5sj
    @RiteshKumar-nt5sj Před 2 lety

    int ka array nahi bana sakte..condition m if(i+j! = 0) kar dege

  • @Adarsh-ft3nw
    @Adarsh-ft3nw Před 3 lety

    Sir hamne isme Integer.MAX_VALUE kyu use kiya hai ?

  • @crackthecode1372
    @crackthecode1372 Před 3 lety +1

    U r god😭🙏

  • @maheriyajatinbharatbhai3538

    Hello sir,
    for this input
    2 3 1 1 4
    our DP solution is giving answer as 3
    but actual answer is 2 . ( 2->3->4). 2 jumps

    • @mellowftw
      @mellowftw Před 2 lety

      Kaise hoga bro sahi

    • @damanshinde1652
      @damanshinde1652 Před 2 lety

      bhai 6 stairs hain 0,1,2,3,4,5 aur last wali stair(5th wali) par koi jump value nahi rehati, ab try kar lena 3:00 se method follow karke answer aa jayega 3

    • @sujeet3035
      @sujeet3035 Před 2 lety +1

      n-1 of dp will also be initialized with 0 and outer loop will start from n-2. all test cases will be passed

  • @nikhilupadhyay2199
    @nikhilupadhyay2199 Před rokem

    SIr your explanation is the best ,but this code is not working fine

  • @codingwithadesh6935
    @codingwithadesh6935 Před 2 lety

    Op❤️

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Hope you like the video.
      For better experience and well organised content sign up on nados.io
      And for being updated follow us on Instagram instagram.com/pepcoding/

  • @ishanpatni2684
    @ishanpatni2684 Před 3 lety +1

    Sir ye bataye ki koi agar first time DP kar raha ho aur saari video ke solution code nahi kar paa raha par question ko think kar raha and diagrams bhi execute ho rahe phir code implementation ke liye kya kare?

    • @Pepcoding
      @Pepcoding  Před 3 lety +3

      beta, maan lijie ki 200 ke 200 question ke bhi video dekh liye. Aur ab ye sare aa gae. To mai aapko ye bta sakta hun ki ache se dekhe honge aur dekh ke submit kiye honge to aap DP mei kabhi maat nahi khaenge.

  • @lakshayrastogi2347
    @lakshayrastogi2347 Před 3 lety +2

    can anyone tell me, Which data type should I take instead of Integer [ ] in C++?

  • @nikhilupadhyay2199
    @nikhilupadhyay2199 Před rokem

    Sir your code is not working properly , I try to run same code on GFG and Leetcode compiler but it's return wrong ans ,Please rpl sir

  • @AbhishekKumar-hi8oj
    @AbhishekKumar-hi8oj Před 3 lety +1

    Sir, I have one suggestion, after each videos if possible please confirm the time complexity.

  • @ayushkwal
    @ayushkwal Před 3 lety +3

    In CPP,
    How we can set value null in array?

  • @amaancodes
    @amaancodes Před 3 lety +3

    Sir your content and teaching way is best! But a small request to the editor is kindly don't insert meme content or any other distraction in between, it just breaks the flow and concentration. I hope it's understandable. Thanks

  • @saksham41592
    @saksham41592 Před 4 lety +1

    Please solve coin change problem also

    • @Pepcoding
      @Pepcoding  Před 4 lety +1

      Abhi abhi solve ki hai, aj raat ko dalegi.

  • @shauncrasta619
    @shauncrasta619 Před 3 lety

    I think the code fails for testcase 2,0,0

  • @pasitopasito1967
    @pasitopasito1967 Před 4 lety +1

    Sir climb with variable jump me humne destination index ko 1 dia tha par isme 0 dia aisa kyu yw problem hai minimum number of moves to reach destination

    • @Pepcoding
      @Pepcoding  Před 4 lety +6

      yar jab path pooche hain na to 1 lenge kyunki destination to destination 1 path hota hai (keep standing and don't move). Jab steps ya minimum moves poocha jae to 0 hota hai (kyunki destination to destination 0 move lagta hai)

    • @anjneykumarsingh4461
      @anjneykumarsingh4461 Před 3 lety +1

      Question hi nhi smjhe mtlb ap

  • @anuznagpal2209
    @anuznagpal2209 Před 3 lety +2

    n=10
    arr = 2 ,3 ,1, 1, 2 ,4, 2, 0 ,1 ,1
    Sir is test case ka ans 4 h lain code 5 bata raha h

    • @sujeet3035
      @sujeet3035 Před 2 lety

      There is logical mistake i guess , if you are at the top then you can have 0 move to reach the top. so correction you can make is dp[n-1] = 0 and start outer loop from n-2;
      class Solution {
      public int jump(int[] nums) {
      int n = nums.length;
      Integer[] dp = new Integer[n+1];
      dp[n] = 0;
      dp[n-1] = 0;

      for(int i =n-2;i>= 0;i--)
      {
      if(nums[i] > 0)
      {
      int min = Integer.MAX_VALUE;
      for(int j =1;j

  • @bikramjitdas2621
    @bikramjitdas2621 Před 3 lety +1

    Sir, CPP mein dp[] ko null kaise karein?? agar isko 0 lege toh dp[i] kabhi koi dusra value nahi ayega other thn 0 and also bool array liya toh sirf true or false lega...how to solve this problem?

    • @ankitbhardwaj7363
      @ankitbhardwaj7363 Před 3 lety +1

      jump array me jaha jaha 0 h, usko INT_MAX kardo.

    • @vortex370
      @vortex370 Před rokem

      Abe bhai vector use kr na 🙃🙃🙃

  • @letsdoeverythinginoneweek9398

    isma humna bada INTEGER WRAPPER CLASS ISLIYA LIYA NA TAAKI MINIMUM OF 0 SA BACHH SAKAA

  • @fashionvella730
    @fashionvella730 Před 3 lety

    i came from C++ and solved 1-2 question in java now get stuck in java and solve 15 questions using java

  • @TheShantanu1395
    @TheShantanu1395 Před 2 lety

    Python code for above problem
    import math
    def takeInput():
    arr = []
    for _ in range(int(input())):
    arr.append(int(input()))
    return arr
    def compute(arr):
    n = len(arr)
    dp = [math.inf]*(n+1)
    dp[n] = 0
    for i in range(n - 1, -1, -1):
    minVal = math.inf
    for j in range(1, arr[i] + 1):
    if i + j < len(dp):
    minVal = min(minVal, dp[i + j])
    if minVal!=math.inf:
    dp[i] = minVal + 1
    return dp[0]

    print(compute(takeInput()))

  • @rajdeepghosh5556
    @rajdeepghosh5556 Před 2 lety

    Is not this problem kind of same like min. Jumps to reach end of array ?

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad it was helpful, for better experience and well organised content sign up on nados.io and start learning.

  • @VaibhavSethF
    @VaibhavSethF Před 3 lety

    Sir, is memorization technique is not easy as compared to tabulation ?

    • @Pepcoding
      @Pepcoding  Před 3 lety +2

      Yes it is, and that is why I think it is not advisable.

    • @sameer1571
      @sameer1571 Před 3 lety

      @@Pepcoding so should we use it or not

  • @ashishjha8751
    @ashishjha8751 Před 4 lety +3

    Sir please rectify cpp issue in editor. It is not executing the code in cpp

    • @Pepcoding
      @Pepcoding  Před 4 lety +1

      I will get it checked.

    • @Code_Note
      @Code_Note Před 3 lety +2

      @@Pepcoding still problem persists ans is not coming

    • @aryanadi8494
      @aryanadi8494 Před 2 lety

      @@Code_Note Still the same problem right?

    • @aryanadi8494
      @aryanadi8494 Před 2 lety

      What is wrong here?

    • @Code_Note
      @Code_Note Před 2 lety

      @@aryanadi8494 i have to check bro , I switched the platform for practicing problems.

  • @awnishnegi4826
    @awnishnegi4826 Před 3 lety

    Can we do this using recursion??

  • @lokeshnegi5051
    @lokeshnegi5051 Před 3 lety +2

    sir agr code c++ me bhi mil jata or mza ajata.

    • @abhishekanand5898
      @abhishekanand5898 Před 3 lety

      vectordp(n+1,INT_MAX) use kr le bhai bas baaki sab same hai...

  • @ashishrawat770
    @ashishrawat770 Před 3 lety

    But sir this will have O(n^2) time complexity for worst case

  • @vivekbharti1792
    @vivekbharti1792 Před 2 lety

    Can we solve this by memoization ?

    • @Pepcoding
      @Pepcoding  Před 2 lety

      You can refer to nados.io for better experience and well curated content. You will get multiple of options too. Even you can post your queries on community section of NADOS.

  • @SCRIPTSAG
    @SCRIPTSAG Před 3 lety +1

    Sir esme kitna hoga time complexity and space complexity

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Beta n

    • @LegitGamer2345
      @LegitGamer2345 Před 3 lety +1

      @@Pepcodingbut if i have an array of size 3 , all the elements in array are 3 , then there will be n(n+1)/2 comparisons ?

    • @LegitGamer2345
      @LegitGamer2345 Před 3 lety

      @@Pepcoding sir n kaise , please reply asap

  • @neerajyadav9412
    @neerajyadav9412 Před 3 lety

    mai soch rha hu sir aap ye course nhi late to hamara kya hota...thank u sir..

  • @ayushgoel9584
    @ayushgoel9584 Před 4 lety +1

    Sir thoda video uploading ki speed and frequency increase kar dijiye please

    • @Pepcoding
      @Pepcoding  Před 4 lety +4

      ji, poori koshish rahegi. mai bhi tabhi satisfy hounga jab roj 25 videos dalein.

    • @ashishjha8751
      @ashishjha8751 Před 4 lety

      @@Pepcoding much needed sir .

  • @sagarsrivastava1236
    @sagarsrivastava1236 Před 4 lety +1

    Bhaiya if I solves 1000+ problems on leetcode. Will that be enough?

  • @suvamgupta2914
    @suvamgupta2914 Před 2 lety

    I have a doubt that can this problem be solved using memoization?

    • @Pepcoding
      @Pepcoding  Před 2 lety

      For better insight, visit nados.io, post your doubts, community will help you out there.

    • @suvamgupta2914
      @suvamgupta2914 Před 2 lety

      @@Pepcoding okay thanks

  • @mehakbhatia1314
    @mehakbhatia1314 Před 3 lety

    Sir when I run the loop from ar[i] to 1:
    for(int jumps = ar[i]; jumps >= 1 && i + jumps

    • @hodex5763
      @hodex5763 Před 3 lety

      In the first case u are terminating the loop as soon as the array has jump allowed less than 1 in this case like in 4 we aren't allowed to make any jump and in your code at position 4 the loop will break

  • @sadmanabedin1203
    @sadmanabedin1203 Před 3 lety +1

    The problem can be solved using the opposite direction, (traveling from 0 to n).
    Thanks to Leetcode problems Min Cost Climbing Stairs and House Robber. Solving those problems few days ago, I got this idea.
    My solution:
    =======
    n = int(input())
    arr = []
    for i in range(0, n):
    c = int(input())
    arr.append(c)
    dp = [500]*(n+1)
    dp[0] = 0
    for i in range(0, n):
    if arr[i]!=0:
    j = 1
    while j

  • @devanshpatel1208
    @devanshpatel1208 Před rokem

    Sir I think, It is not Optimised solution for this problem

  • @MohitSingh-br7ud
    @MohitSingh-br7ud Před 3 lety

    Sir this program fails in this case: n=6, arr= 1 4 3 2 6 7. Actual o/p= 3, Expected= 2

    • @RohitSingh-so5yf
      @RohitSingh-so5yf Před 3 lety +1

      There's one more case where it fails..
      10
      2 3 1 1 2 4 2 0 1 1
      Actual Output = 5 Expected = 4

    • @LegitGamer2345
      @LegitGamer2345 Před 3 lety

      dry run theek se karo 3 is correct

    • @LegitGamer2345
      @LegitGamer2345 Před 3 lety

      @@RohitSingh-so5yf dry run theek se karo 5 is correcttttttt

    • @shivamsinha5554
      @shivamsinha5554 Před 2 lety

      make dp array of size n not n+1

  • @deepakojha3216
    @deepakojha3216 Před 3 lety

    The same code is failing at GFG
    10
    2 3 1 1 2 4 2 0 1 1
    Its Correct output is:
    4
    And Your Code's output is:
    5

  • @LegitGamer2345
    @LegitGamer2345 Před 3 lety

    Time complexity iski n square nahi hogi ? If I have an array of size 3 and each array has 3 in it

  • @sudhanshurai2062
    @sudhanshurai2062 Před 3 lety

    Sir why is int array of Dp not gonna work in this problem?

    • @vikasjoshi7236
      @vikasjoshi7236 Před 3 lety

      int array in by default initialised with 0 .
      Integer array are initialized by null.
      Since we need null ,thus we use integer array

  • @sahilchhabra5985
    @sahilchhabra5985 Před 4 lety +1

    sir please share notes

  • @sarveshkaushal4585
    @sarveshkaushal4585 Před 3 lety +1

    They say DP is counter intuitive and tough. Me: Ha Ha. Just see Sumeet sir's video.

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Haha..nice
      If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

  • @srishtigugoriya9319
    @srishtigugoriya9319 Před 2 lety

    bhut confusion ho raha ab to

  • @omprakash-dz2xh
    @omprakash-dz2xh Před 3 lety

    This fails for input {2,3,1,1,2,4,2,0,1,1}
    Solution
    static void minJumpsTab1(int[] arr) {
    int[] dp = new int[arr.length + 1];
    Arrays.fill(dp, 0);
    for (int i = arr.length - 1; i >= 0; i--) {
    int jump = arr[i];
    int min = Integer.MAX_VALUE;
    for (int j = 1; j

  • @bleedblack1841
    @bleedblack1841 Před 2 lety

    SUMEET SIR , saying humbly u G.O.A.T
    but in this problem we should make dp[n] and intialize dp[n-1]=0 because this TEST CASE : N=7 VALUES : 1 2 0 3 0 0 0 ....will show incorrect output

  • @Mercer80
    @Mercer80 Před 2 lety

    c++ anyone solved it by initializeing to -1 ????????????????????????????????????????????????????

  • @educationpointe.p1455
    @educationpointe.p1455 Před 3 lety

    Samajh rahe ho 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣

  • @wecan2729
    @wecan2729 Před 2 lety

    Hello sir,
    for this input
    2 3 1 1 4
    our DP solution is giving answer as 3
    but actual answer is 2 . ( 2->3->4). 2 jumps

    • @Pepcoding
      @Pepcoding  Před 2 lety +1

      for doubt support, you can consume this same content on nados.pepcoding.com

    • @Pepcoding
      @Pepcoding  Před 2 lety +1

      Visit: nados.pepcoding.com/ where many coders like you, who can help you with your doubts, are active on a daily basis.
      Also to be updated regarding any free opportunities we have follow us on insta as well:
      instagram.com/pepcoding/

    • @jagritbudhiraja6391
      @jagritbudhiraja6391 Před 2 lety +2

      Bhai 4th position ke baad ek move aur aayega coz we have to reach 5th position starting from 0th

    • @ghanendrapanwar165
      @ghanendrapanwar165 Před 2 lety

      no correct output is 3 only.