LeetCode 509: Fibonacci Number - Interview Prep Ep 13

preview_player
Показать описание


⭐ Support my channel and connect with me:

// TOOLS THAT I USE:

// MY FAVORITE BOOKS:

Coding interview made simple!

My ENTIRE Programming Equipment and Computer Science Bookshelf:

And make sure you subscribe to my channel!

Your comments/thoughts/questions/advice will be greatly appreciated!

#softwareengineering #leetcode #algorithms #coding #interview #SDE #SWE #SiliconValley #programming #datastructures
Рекомендации по теме
Комментарии
Автор

Thanks for steping through and explaining with two approaches. I would like to ask you four questions regarding int[ ] = fibNums = new int[n + 1]; .

(1) May I know why you add 1 to n. Is it because array index starts from 0??

(2) Approach 1 Array - space complexity - O(n) - is it because you initialise fibNums Array and the size is n (stored in Heap memory)?

(3) fibNums[1] = 1, why don't you initialise fibNums[0] = 0?

(4) I think both approaches are iterative?? Thanks!

ktsuw_