Koko Eating Bananas - Leetcode 875 - Binary Search (Python)

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.พ. 2025
  • 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 TH-cam 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...

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

  • @GregHogg
    @GregHogg  6 หลายเดือนก่อน +2

    Master Data Structures & Algorithms For FREE at AlgoMap.io!

  • @ramineye6498
    @ramineye6498 หลายเดือนก่อน +7

    koko is overthinking this, just eat and be happy and leave us out of it

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

    I’ve said it before and I’ll say it again - you are such a gifted teacher!

    • @GregHogg
      @GregHogg  6 หลายเดือนก่อน +2

      Thank you so much!!

  • @ParthPatel-xb2cn
    @ParthPatel-xb2cn 3 หลายเดือนก่อน +2

    def koko(eating_capacity):
    if eating_capacity 1000:
    return "Koko has transcended to MONSTER status"
    else:
    return "Koko is... in a mysterious state”

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

    O my god! this is amazing . thank you sir. I have watch 2 videos before even tried myself . After watching this I successfully understand it.

  • @Johnson_Amah
    @Johnson_Amah 4 หลายเดือนก่อน +1

    Hey Greg. I found that l

  • @younis533
    @younis533 7 หลายเดือนก่อน +1

    I would have liked and illustrated explanation to the tech you used at the end, also wouldnt checking if a k works then checking k-1 doesnt work then that k is my answer

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

    Amazing solution! thanks for sharing

  • @SeanKearney-g7d
    @SeanKearney-g7d 4 หลายเดือนก่อน

    god dam you killed this Greg

  • @zhihangcheng1083
    @zhihangcheng1083 5 หลายเดือนก่อน

    Hello, I’ve recently started learning binary search and have encountered several challenges. I often struggle with deciding whether to use while l

  • @zhihangcheng1083
    @zhihangcheng1083 5 หลายเดือนก่อน

    Great video! But I believe that the slowest speed could be optimized to math.ceil(sum(piles) / h), not 1

  • @FaberLSH
    @FaberLSH 7 หลายเดือนก่อน

    Thank you so much!

  • @xiranli3239
    @xiranli3239 7 หลายเดือนก่อน

    You are amazing❤

    • @GregHogg
      @GregHogg  7 หลายเดือนก่อน

      Thank you!

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

    what does the function k_works return??
    what is meant by if k_works(k) ??

    • @GregHogg
      @GregHogg  7 หลายเดือนก่อน +2

      True if k works, false otherwise

    • @moonlight-td8ed
      @moonlight-td8ed 6 หลายเดือนก่อน +1

      it return True if monkey can eat k number of bananas in a pile in time

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

    while solving this problem I am craving bananas 🤣

  • @DivineEdoka
    @DivineEdoka 4 หลายเดือนก่อน

    My question is why is binary search working even when the arrray is unsorted

    • @GregHogg
      @GregHogg  4 หลายเดือนก่อน +2

      We're not binary searching the array, we're searching the space for k