Best Time to Buy and Sell Stock II - Leetcode 122 - Arrays & Strings (Python)

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024
  • Master Data Structures & Algorithms for FREE at AlgoMap.io/
    Code solutions in Python, Java, C++ and JS for this can be found at my GitHub repo here: github.com/gah...
    Complete DSA Pathway Zero to Hero: • Data Structures & Algo...
    Please check my playlists for free DSA problem solutions:
    • Fundamental DSA Theory
    • 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...
    My Data Science & ML RUclips Playlist: • Greg's Path to Become ...
    Learn Python and Data Science FASTER at mlnow.ai :)
    Support the content: / @greghogg
    Follow me on Instagram: / greghogg5
    Connect with me on LinkedIn: / greghogg
    Follow me on TikTok: / greghogg5
    Coursera Plus: imp.i384100.ne...
    My Favorite Courses:
    Data Structures & Algorithms:
    UCalifornia San Diego DSA: imp.i384100.ne...
    Stanford Algorithms: imp.i384100.ne...
    Python Data Structures: imp.i384100.ne...
    Meta Coding Interview Prep: imp.i384100.ne...
    Python:
    UMichigan Python for Everybody: imp.i384100.ne...
    Python Mastery from MLNOW.ai: mlnow.ai/cours...
    Google IT Automation w/ Python: imp.i384100.ne...
    Web Dev / Full Stack:
    Meta Front-End Developer: imp.i384100.ne...
    IBM Full Stack Developer: imp.i384100.ne...
    Meta Back-End Developer: imp.i384100.ne...
    John Hopkins HTML, CSS & JS: imp.i384100.ne...
    IBM DevOps: imp.i384100.ne...
    Cloud Development:
    AWS Fundamentals: imp.i384100.ne...
    GCP Cloud Engineer: imp.i384100.ne...
    Microsoft Azure Fundamentals: imp.i384100.ne...
    Game Development:
    Michigan State Unity Development: imp.i384100.ne...
    UColorado C++ for Unreal Engine: www.coursera.o...
    SQL & Data Science:
    SQL by MLNOW.ai: mlnow.ai/cours...
    Python for Data Science by MLNOW.ai: mlnow.ai/cours...
    Google Data Analytics: imp.i384100.ne...
    IBM Data Science: imp.i384100.ne...
    IBM Data Engineer: imp.i384100.ne...
    Machine Learning & AI:
    ML Mastery at MLNOW.ai: mlnow.ai/cours...
    ML w/ Andrew Ng: www.coursera.o...
    Deep Learning w/ Andrew Ng: imp.i384100.ne...

Комментарии • 10

  • @GregHogg
    @GregHogg  Месяц назад

    Master Data Structures & Algorithms for FREE at AlgoMap.io/

  • @thomasbooth2778
    @thomasbooth2778 Месяц назад +2

    Theres also a really nice greedy solution to this also. Where it mentions 'You can buy it then immediately sell it on the same day.' Was something I overlooked at the start and wrote a solution like yours. Definitely worth noting to look for small bits of info like this in problems

  • @pawelrolbiecki7813
    @pawelrolbiecki7813 День назад

    But you can buy and sell it the same day. So why don't we do it "scalping" way? make profit "day by day" ? It simplifies the aproach and it is fatser.

  • @JoeTan-nq4fq
    @JoeTan-nq4fq 8 дней назад

    It would be similar that we calculate the difference of today's and y'day's price for all prices. The max profit would be the sum of all the profits (ignore the losses).

  • @RuoyanJiang
    @RuoyanJiang 24 дня назад

    Love your video, it was concise, the solution was easy to understand and definitely helped me prepare for the interview, thanks :)

  • @JoeTan-nq4fq
    @JoeTan-nq4fq 8 дней назад

    Love your videos. Concise and easy to understand.

  • @angelomarano8458
    @angelomarano8458 Месяц назад +2

    love this videos, very helpfull!.

  • @ambersautner
    @ambersautner Месяц назад +3

    extremely thorough and easy to understand! thank you for making these videos, im planning on binging your channel lolol

    • @GregHogg
      @GregHogg  Месяц назад

      Binge it up at algomap.io :)