From 554f53e4cc2d59a8f508964a77e679b3cc9ed36e Mon Sep 17 00:00:00 2001 From: Arnab Das <93949960+Arnab7456@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:55:17 +0530 Subject: [PATCH 1/6] Integer Overflow in Max Heap Comparator for K Closest Points to Origin The current implementation can potentially cause overflow when the distances are large. issue solve Id: #21 --- patterns/java/TopKElements.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 maxHeap = new PriorityQueue<>((a, b) -> getDistance(b) - getDistance(a)); + PriorityQueue maxHeap = new PriorityQueue<>( + (a, b) -> Integer.compare(getDistance(b), getDistance(a)) + ); // Iterate through all points for (int[] point : points) { @@ -146,4 +148,4 @@ public int[][] kClosestPointsToOriginMaxHeapApproach(int[][] points, int k) { return result; } -} \ No newline at end of file +} From ab5aff1809fedcf72a499a378eed916cdb11f259 Mon Sep 17 00:00:00 2001 From: Ashish Pratap Singh Date: Fri, 21 Feb 2025 18:11:01 +0530 Subject: [PATCH 2/6] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d2a4bb..44bee45 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,9 @@ This repository contains awesome LeetCode resources to learn Data Structures and If you want to practice curated list of LeetCode problems organized by 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) From a404f08093b9786c7af02f3ccc800d3dff219e6e Mon Sep 17 00:00:00 2001 From: Ashish Pratap Singh Date: Sat, 1 Mar 2025 02:39:27 +0530 Subject: [PATCH 3/6] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 44bee45..2ea2fc4 100644 --- a/README.md +++ b/README.md @@ -111,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! +

From 17cc5669f2bd5f2efe784ea0e1ce6f8e5fb5ec01 Mon Sep 17 00:00:00 2001 From: Ashish Pratap Singh Date: Tue, 10 Jun 2025 13:43:10 +0530 Subject: [PATCH 4/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ea2fc4..e69f67e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ 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 I Mastered DSA](https://blog.algomaster.io/p/how-i-mastered-data-structures-and-algorithms) From 3f91644c8ae9c3694b9301044dad74459003b326 Mon Sep 17 00:00:00 2001 From: Ashish Pratap Singh Date: Sun, 9 Nov 2025 04:53:00 +0530 Subject: [PATCH 5/6] Add AlgoMaster DSA Playlist link to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e69f67e..9bce5b7 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ This repository contains awesome LeetCode resources to learn Data Structures and ## 📌 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) - [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) @@ -82,6 +83,7 @@ This repository contains awesome LeetCode resources to learn Data Structures and - [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) From e58e40fa22d910bcb0ef71a5368702a1357cdbc0 Mon Sep 17 00:00:00 2001 From: Ashish Pratap Singh Date: Mon, 10 Nov 2025 08:08:32 +0530 Subject: [PATCH 6/6] Revise links and organize pattern resources Updated links for Arrays and Linked List sections. Added lists to multiple pattern links for better organization. --- README.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 9bce5b7..82fcc31 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,10 @@ This repository contains awesome LeetCode resources to learn Data Structures and ## 📌 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) +- [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) @@ -44,15 +43,14 @@ This repository contains awesome LeetCode resources to learn Data Structures and ## 🚀 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)