Leetcode 70. Climbing Stairs [Java] | Two best approaches

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 เม.ย. 2021
  • Check out how to solve the leetcode 70 Climbing Stairs question in Java. This is one of GOOGLE's most commonly asked coding interview questions according to Leetcode. In this video, you will see two possible solutions which both are faster than 100% of the leetcode submissions.
    Question URL: leetcode.com/problems/climbin...
    Please write in the comments below which leetcode problem you want me to solve next.
    And remember, a leetcode a day keeps unemployment away!
    Thanks for watching!
    #leetcode70
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 21

  • @raj_kundalia
    @raj_kundalia 6 หลายเดือนก่อน

    thank you!

    • @ifelsestatement7803
      @ifelsestatement7803  6 หลายเดือนก่อน

      You are always welcome! Thanks for the comment!

  • @maksymr.7191
    @maksymr.7191 ปีที่แล้ว

    Thank you, bro. It's very helpful now.

  • @sarankarthicg5208
    @sarankarthicg5208 11 หลายเดือนก่อน

    Thank you so much mate!

    • @ifelsestatement7803
      @ifelsestatement7803  11 หลายเดือนก่อน

      You are welcome! Thanks for your comment!

  • @user-fj3zh8cv7p
    @user-fj3zh8cv7p 11 หลายเดือนก่อน

    Thank you for this video! I am still learning about time complexity and I was wondering how your solutions differ from what I came up with =>
    const steps = (n) => {
    if(n === 0 || n === 1) return 1;
    return stairs(n-2) + stairs(n-1);
    }

  • @clickrad
    @clickrad 11 หลายเดือนก่อน +1

    Fibonacci

  • @poojamadhu2201
    @poojamadhu2201 ปีที่แล้ว

    thanks

  • @asmaasadek7735
    @asmaasadek7735 2 ปีที่แล้ว

    Thanks alot that was pretty clear.

  • @molihey
    @molihey ปีที่แล้ว

    thanks a lot! Amazing

  • @nikstatus0735
    @nikstatus0735 2 ปีที่แล้ว

    thnks really easy code to understand

  • @yugeshm8224
    @yugeshm8224 ปีที่แล้ว

    Thanks man

  • @cinemafellaz
    @cinemafellaz 2 ปีที่แล้ว

    why do we need to specify the n==1 case?
    if (n

    • @vicente3j
      @vicente3j ปีที่แล้ว +1

      The way he codes it it would throw a runtime time error since right after dp[1] = 1 you say dp[2] = 2. Index 2 is outside of the bounds of the array (size is 2, last index is 1)

  • @Steklopod
    @Steklopod 3 หลายเดือนก่อน

    Нихрена не объяснил. Чисто заготовку напечатал

    • @ifelsestatement7803
      @ifelsestatement7803  3 หลายเดือนก่อน

      Ну не знаю, вроде все должно быть понятно