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

preview_player
Показать описание
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.

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
Рекомендации по теме
Комментарии
Автор

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);
}

JasonGarcia-xd
Автор

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

maksymr.
Автор

why do we need to specify the n==1 case?
if (n <= 1) {
return 1;
}
isn't dp[1]=1; is already for n=1 case?

cinemafellaz
Автор

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

Steklopod
join shbcf.ru