Fibonacci Number - Leetcode 509 - Dynamic Programming (Python)

Sdílet
Vložit
  • čas přidán 28. 05. 2024
  • The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-So...
    Please check my playlists for free DSA problem solutions:
    • Array & String Questions
    • 2 Pointers Questions
    • Sliding Window Questions
    • Binary Search Questions
    • Stack Questions
    • Linked List Questions
    • Tree Questions
    • Heap Questions
    • Recursive Backtracking...
    • Graph Questions
    • Dynamic Programming (D...
    Learn Python and Data Science at mlnow.ai :)
    Best Courses for Analytics:
    ---------------------------------------------------------------------------------------------------------
    + IBM Data Science (Python): bit.ly/3Rn00ZA
    + Google Analytics (R): bit.ly/3cPikLQ
    + SQL Basics: bit.ly/3Bd9nFu
    Best Courses for Programming:
    ---------------------------------------------------------------------------------------------------------
    + Data Science in R: bit.ly/3RhvfFp
    + Python for Everybody: bit.ly/3ARQ1Ei
    + Data Structures & Algorithms: bit.ly/3CYR6wR
    Best Courses for Machine Learning:
    ---------------------------------------------------------------------------------------------------------
    + Math Prerequisites: bit.ly/3ASUtTi
    + Machine Learning: bit.ly/3d1QATT
    + Deep Learning: bit.ly/3KPfint
    + ML Ops: bit.ly/3AWRrxE
    Best Courses for Statistics:
    ---------------------------------------------------------------------------------------------------------
    + Introduction to Statistics: bit.ly/3QkEgvM
    + Statistics with Python: bit.ly/3BfwejF
    + Statistics with R: bit.ly/3QkicBJ
    Best Courses for Big Data:
    ---------------------------------------------------------------------------------------------------------
    + Google Cloud Data Engineering: bit.ly/3RjHJw6
    + AWS Data Science: bit.ly/3TKnoBS
    + Big Data Specialization: bit.ly/3ANqSut
    More Courses:
    ---------------------------------------------------------------------------------------------------------
    + Tableau: bit.ly/3q966AN
    + Excel: bit.ly/3RBxind
    + Computer Vision: bit.ly/3esxVS5
    + Natural Language Processing: bit.ly/3edXAgW
    + IBM Dev Ops: bit.ly/3RlVKt2
    + IBM Full Stack Cloud: bit.ly/3x0pOm6
    + Object Oriented Programming (Java): bit.ly/3Bfjn0K
    + TensorFlow Advanced Techniques: bit.ly/3BePQV2
    + TensorFlow Data and Deployment: bit.ly/3BbC5Xb
    + Generative Adversarial Networks / GANs (PyTorch): bit.ly/3RHQiRj
    Become a Member of the Channel! bit.ly/3oOMrVH
    Follow me on LinkedIn! / greghogg
    Full Disclosure:
    Please note that I may earn a commission for purchases made at the above sites! I strongly believe in the material provided; I only recommend what I truly think is great. If you do choose to make purchases through these links; thank you for supporting the channel, it helps me make more free content like this!

Komentáře • 22

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

    Precise explanation, loved it!

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

    I love how he said,
    The steps of dynamic programming :
    Step 1 - don't use dynamic programming
    😂😂

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

      It's true and I'll absolutely stand by this

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

    Very nice explanation, I used a decorator approach to improve performance, but your solutions are amazing

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

      Thank you so much! And yeah, I assume you mean the @cache decorator. Wanted to avoid that for coding interviews. Thanks a ton!!

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

    Love the videos and shorts!

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

      Very glad to hear it, thank you :)

  • @FrozenKnight21
    @FrozenKnight21 Před 25 dny

    I kinda did this diffrently, but i guess it amounts to the same thing.
    I used an array, with a window, fulled in the first few values, then worked my way backwards.
    However, i had to later update it because i didnt realize there are negative fibanati numbers, and computing them is similar but a little trickier. But i did find a good work arround in the end.

    • @GregHogg
      @GregHogg  Před 25 dny

      Uhm I don't think there is negative Fibonacci numbers

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

    Great video as always. I was curious why is the golden ratio solution log time? I figured it would be constant time.

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

      Thank you! It's because raising it to the power n is expensive

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

    Cool!

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

    sublime

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

    👍

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

    Can you upload complete one shot python (covering all things required for dsa)

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

      Yeah I've got that video just search for full python course Greg hogg

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

    69th like... lets gooo