K Closest Points to Origin - Leetcode 973 - Heaps (Python)

Поділитися
Вставка
  • Опубліковано 19 вер 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 UA-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...

КОМЕНТАРІ • 9

  • @GregHogg
    @GregHogg  Місяць тому

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

  • @user-jm6gp2qc8x
    @user-jm6gp2qc8x 13 днів тому

    its so wonderful to realise that this heap DS is helping us to solve a problem that involves k smallest, k largest etc, by not doing a useless sorting all of the elements involved.

  • @kauegatto
    @kauegatto 2 місяці тому

    finally understood this problem, ty a lot!

    • @GregHogg
      @GregHogg  2 місяці тому

      Glad to hear it, no worries!

  • @kumaranb8702
    @kumaranb8702 8 місяців тому

    Nice information 😊

  • @tm-luk317
    @tm-luk317 8 місяців тому +1

    What is the name of the software he uses as a blackboard?

    • @GregHogg
      @GregHogg  7 місяців тому +3

      He uses miro

    • @deeps-n5y
      @deeps-n5y 6 місяців тому

      @@GregHogg 😂

  • @miramar-103
    @miramar-103 Місяць тому

    return heapq.nsmallest(k, points, lambda p : math.sqrt(p[0]**2 + p[1]**2))