diff --git a/README.md b/README.md index 8d2a4bb..82fcc31 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,20 @@ This repository contains awesome LeetCode resources to learn Data Structures and Algorithms (DSA) and prepare for Coding interviews. -If you want to practice curated list of LeetCode problems organized by patterns, checkout [AlgoMaster.io](https://algomaster.io) +👉 If you want to master DSA patterns, checkout [AlgoMaster.io](https://algomaster.io) ## 💡 Tips -- [How to Start LeetCode](https://blog.algomaster.io/p/how-to-start-leetcode-in-2025) - [How I Mastered DSA](https://blog.algomaster.io/p/how-i-mastered-data-structures-and-algorithms) +- [How to Start LeetCode](https://blog.algomaster.io/p/how-to-start-leetcode-in-2025) +- [15 Leetcode Patterns](https://blog.algomaster.io/p/15-leetcode-patterns) ## 📌 Fundamental Concepts - [Algorithmic Complexity](https://blog.algomaster.io/p/57bd4963-462f-4294-a972-4012691fc729) - [Big-O Cheat Sheet](https://www.bigocheatsheet.com/) +- [Arrays](https://www.youtube.com/watch?v=SlNq09scdWE&list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2) - [Bit Manipulation Techniques](https://blog.algomaster.io/p/c650df76-f978-46ee-a572-eb13c354905d) - [Sorting Algorithms](https://medium.com/jl-codes/understanding-sorting-algorithms-af6222995c8) -- [Linked List](https://leetcode.com/discuss/study-guide/1800120/become-master-in-linked-list) - - [Dummy Node Technique](https://blog.algomaster.io/p/5d7a1368-7a0c-461a-93a9-732333ceb2a8) +- [Linked List](https://www.youtube.com/watch?v=FbHf0ii0WDg&list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2) - [Queues](https://medium.com/basecs/to-queue-or-not-to-queue-2653bcde5b04) - [Stacks](https://medium.com/basecs/stacks-and-overflows-dbcf7854dc67) - [Hash Tables](https://medium.com/basecs/taking-hash-tables-off-the-shelf-139cbf4752f0) @@ -42,15 +43,14 @@ If you want to practice curated list of LeetCode problems organized by patterns, ## 🚀 Patterns - [15 Leetcode Patterns](https://blog.algomaster.io/p/15-leetcode-patterns) - [20 DP Patterns](https://blog.algomaster.io/p/20-patterns-to-master-dynamic-programming) -- [Two Pointers Pattern](https://www.youtube.com/watch?v=QzZ7nmouLTI) -- [Sliding Window Pattern](https://blog.algomaster.io/p/f4412a17-7a3a-4d0b-8e39-9ea8f429bf7c) -- [Prefix Sum Pattern](https://www.youtube.com/watch?v=yuws7YK0Yng) -- [Fast and Slow Pointers Pattern](https://www.youtube.com/watch?v=b139yf7Ik-E) -- [Top 'K' Elements Pattern](https://www.youtube.com/watch?v=6_v6OoxvMOE) -- [Kadane's Algorithm](https://www.youtube.com/watch?v=NUWAXbSlsws) -- [Sliding Window Pattern](https://www.youtube.com/watch?v=y2d0VHdvfdc) -- [Linked List In-place Reversal Pattern](https://www.youtube.com/watch?v=auoTGovuo9A) -- [Monotonic Stack Pattern](https://www.youtube.com/watch?v=DtJVwbbicjQ) +- [Two Pointers Pattern](https://www.youtube.com/watch?v=QzZ7nmouLTI&list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2) +- [Sliding Window Pattern](https://www.youtube.com/watch?v=y2d0VHdvfdc&list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2) +- [Prefix Sum Pattern](https://www.youtube.com/watch?v=yuws7YK0Yng&list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2) +- [Fast and Slow Pointers Pattern](https://www.youtube.com/watch?v=b139yf7Ik-E&list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2) +- [Top 'K' Elements Pattern](https://www.youtube.com/watch?v=6_v6OoxvMOE&list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2) +- [Kadane's Algorithm](https://www.youtube.com/watch?v=NUWAXbSlsws&list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2) +- [Linked List In-place Reversal Pattern](https://www.youtube.com/watch?v=auoTGovuo9A&list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2) +- [Monotonic Stack Pattern](https://www.youtube.com/watch?v=DtJVwbbicjQ&list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2) - [Overlapping Intervals Pattern](https://blog.algomaster.io/p/812e72f7-eced-4256-a4c1-00606ae50679) - [Backtracking Pattern](https://blog.algomaster.io/p/81d42ca2-600c-4252-aa33-a56462090048) - [Modified Binary Search Pattern](https://blog.algomaster.io/p/d0d81b04-4c2a-4b45-a101-5137c3146686) @@ -81,6 +81,7 @@ If you want to practice curated list of LeetCode problems organized by patterns, - [Leetcode Top Interview 150](https://leetcode.com/studyplan/top-interview-150/) ## 📺 YouTube Playlist +- [AlgoMaster DSA Playlist](https://www.youtube.com/playlist?list=PLK63NuByH5o9odyBT7nfYkHZyvGQ5oVp2&pp=gAQB) - [AlgoMaster LeetCode Pattern Playlist](https://www.youtube.com/playlist?list=PLK63NuByH5o-tqaMUHRA4r8ObRW7PWz45) - [Abdul Bari's Algorithms Playlist](https://www.youtube.com/playlist?list=PLDN4rrl48XKpZkf03iYFl-O29szjTrs_O) - [William Fiset's Data Structure Playlist](https://www.youtube.com/playlist?list=PLDV1Zeh2NRsB6SWUrDFW2RmDotAfPbeHu) @@ -110,3 +111,9 @@ If you want to practice curated list of LeetCode problems organized by patterns, - [LeetCode VS Code Extension](https://marketplace.visualstudio.com/items?itemName=LeetCode.vscode-leetcode): Solve LeetCode problems in VS Code. Your contributions are most welcome! + +--- + +
+ If you find this resource helpful, please give it a star ⭐️ and share it with others! +
diff --git a/patterns/java/TopKElements.java b/patterns/java/TopKElements.java index c84c391..15946b1 100644 --- a/patterns/java/TopKElements.java +++ b/patterns/java/TopKElements.java @@ -126,7 +126,9 @@ private int getDistance(int[] point) { public int[][] kClosestPointsToOriginMaxHeapApproach(int[][] points, int k) { // Max heap with custom comparator to compare by distance - PriorityQueue