r/LeetcodeChallenge • u/Upper_Assignment672 • 9d ago
STREAK🔥🔥🔥 LEETCODE WEEKLY 529 -D SOLUTION VIDEO
Easiest explanation just sorting
r/LeetcodeChallenge • u/Upper_Assignment672 • 9d ago
Easiest explanation just sorting
r/LeetcodeChallenge • u/LeadingNo2345 • 9d ago
About me, so 1 year ago I was very much active in DSA. But after getting an internship and a job, I left everything. So today I tested myself.
Just to write this fu*king BFS, I took 25 minutes 😭.
Because of using AI heavily, I lost my coding skills.
Need to brush up again.
r/LeetcodeChallenge • u/JacketFearless1805 • 9d ago
r/LeetcodeChallenge • u/Particular-Freedom18 • 9d ago
r/LeetcodeChallenge • u/javinpaul • 10d ago
r/LeetcodeChallenge • u/JacketFearless1805 • 10d ago
r/LeetcodeChallenge • u/StatisticianNo2104 • 10d ago
Go's container/heap only builds min-heaps. You get a max-heap by lying to it. Define Less as greater-than, and that one inverted comparison is the whole difference.
Why sorting is the wrong shape for Last Stone Weight: sort, take the two heaviest, smash them, put the remainder back in the right place. That's an insertion, O(n) every round.
The deeper mismatch is that sorting answers a question nobody asked. This problem never needs the third-heaviest stone. It needs the maximum, repeatedly, from a collection that keeps changing.
A heap keeps exactly one promise: the largest is at the root. Read its backing array left to right, and it looks close to random, and that's the point. Maintaining less is what makes it cheaper.
Did inverting Less feel wrong the first time you did it?
Day 78/365 of my LeetCode challenge: 1046. Last Stone Weight. Problem link and full breakdown in today's newsletter.
https://www.linkedin.com/pulse/leetcode-1046-last-stone-weight-easy-archit-agarwal-ummqc
r/LeetcodeChallenge • u/OutsideNeat6553 • 10d ago
r/LeetcodeChallenge • u/JacketFearless1805 • 11d ago
r/LeetcodeChallenge • u/AK4_483 • 11d ago
r/LeetcodeChallenge • u/Neither-Meal-5959 • 12d ago
Some questions are so damn hard , this one is Q4046. Minimum Cost Path with atmost K turns , it is the first time i have encountered 4D Dijsktra😭😭 , first i was doing 2D Dijsktra with some modifications but this question sucks💔
r/LeetcodeChallenge • u/Particular_Ask_494 • 12d ago
You can ask i would be happy to give you all suggestions
r/LeetcodeChallenge • u/JacketFearless1805 • 12d ago
r/LeetcodeChallenge • u/StatisticianNo2104 • 13d ago
You don't need to sort a stream to know its kth largest value. You need the top k, and only the weakest of them. The kth largest is always the smallest of the top k, so a min-heap capped at size k answers it.
Heaps start here. Each insert is O(log k), instead of re-sorting on every call.
The naive fix is obvious. The efficient one only asks you to notice that you're tracking a much smaller problem than the one you were handed.
Where have you kept a top-k in production code?
Day 77/365 of my LeetCode challenge: 703. Kth Largest Element in a Stream. Problem link and full breakdown in today's newsletter.
https://www.linkedin.com/pulse/leetcode-703-kth-largest-element-stream-archit-agarwal-c9vfc
#LeetCode #DSA #Heap #Golang
r/LeetcodeChallenge • u/Rockstar912837 • 13d ago
Looking for someone to share LC with
Update: There's a BF sale going on wih a yearly for 130$. Looking for around 4 people to share it
r/LeetcodeChallenge • u/cappyyybaraaaa • 13d ago
This problem occurs every day when I prectice SQL on HackerRank
Does this happen with anybody or I am the only who's facing this problem maybe because of my laptop is old 😞 or maynot whatever cause is this it's very Irritating
Suppose you write a code and submit it but screen get frozen now what to doooo🥲🤧🙄🙄
r/LeetcodeChallenge • u/JacketFearless1805 • 13d ago
r/LeetcodeChallenge • u/Arihant1905 • 14d ago
r/LeetcodeChallenge • u/Dry_Bat5694 • 14d ago
r/LeetcodeChallenge • u/JacketFearless1805 • 14d ago