Find K Pairs with Smallest Sums II Min Heap II Priority Queue II Merge k Sorted List II Leetcode 373
In this video, I'll talk about how to solve Leetcode 373. Find K Pairs with Smallest Sums II Min Heap II Priority Queue II Merge k Sorted List
Checkout DSA-169 Series: • Aryan DSA-169 Series |...
Problem Link: leetcode.com/problems/find-k-...
Code & Notes: drive.google.com/file/d/1mhYl...
Let's Connect:
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / aryan_mittal_007
📱Telegram : t.me/aryan_mittal_group
🤖 Github: github.com/aryan-0077
🛍️ Products I use in Videos: (✨ Marked for Mostly requested Products)
Main Camera (Canon 200D ii): amzn.to/41cfS5h
Vlog Camera (iphone 13): amzn.to/42aOJRh
Tripod for Lectures: amzn.to/3HMoloF
Tripod for Vlogs: amzn.to/44wGL6L
✨Mic: amzn.to/41bj8gU
Shadow Multi Colour Light: amzn.to/41bmIrq
Main Light: amzn.to/3LF6BNb
Tripod for Lights: amzn.to/3LFcQAt
Softbox for Lights: amzn.to/42mHqWE
✨My Pen Tablet for Notes: amzn.to/44A61ZJ
✨New Tablet for Notes: amzn.to/44BjTDa
Tablet Stand: amzn.to/3NMFIJR
Power Bank: amzn.to/421yHsZ
✨USB Hub: amzn.to/3p8NGTf
✨HardDisk to store Lectures: amzn.to/3HKafEs
✨My Laptop: amzn.to/44w12ct
✨My Monitor: amzn.to/3LCG6YL
My UPS: amzn.to/3Lydy2y
My UPS old: amzn.to/3LXT0C3
✨My Mouse: amzn.to/3LYmJdY
✨My Keyboard: amzn.to/3NJs4ah
Resources you can try:
Learn Coding: • Complete RoadMap for C...
🎥Channel Playlists
🎥 Baap Graph Series - by Aryan: • Baap Graph Series - by...
🎥Dynamic Programming: • Complete Dynamic Progr...
🎥Bit Manipulation: • Complete BIT MANIPULAT...
🎥Mathematics for DSA: • Complete Mathematics f...
🎥Leetcode Top Interview Questions: • FAANG & Leetcode Inter...
🎥Codeforces Problem B Ladder: • Complete PROBLEM B LAD...
🎥Codeforces Problem C Ladder: • Codeforces PROBLEM C L...
🎥Codeforces Problem D Ladder: • Complete PROBLEM D LAD...
🎥 Top 150 Interview Questions: • Top 150 Interview Ques...
🎥 Complete Array Problem Playlist: • Complete Array Intuit...
🎥 Complete Binary Search Problem Playlist: • Complete Binary Search...
🎥 Complete Stack Playlist: • Complete Stack & Queue...
🎥 Complete Graph Problem Playlist: • Complete Graph Intuiti...
🎥 Complete TREE Playlist: • Complete TREE Intuitio...
🎥 Complete DP Problem Solving: • Complete DP Intuition ...
🎥 Complete Linked List: • Complete Linked List I...
🎥 Complete Greedy Problem Playlist: • Complete Greedy Intui...
🎥 Complete Divide & Conquer Algorithm Playlist: • Complete Divide & Conq...
🎥 Complete Trie Playlist: • Complete Trie Intuitio...
🎥 Complete Mathematics & Number Theory Problems: • Complete Mathematics &...
About Channel:
We teach about how you can grow in life & educate about programming in Fun & Intuitional way.
About Me:
I am Aryan Mittal - a Software Engineer, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Timelines✨
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms
Пікірлер: 31
This one is Medium level but for Intuition Building is one of the best Problems 🙈 Checkout DSA-169 Series: kzread.info/dash/bejne/Z3aprbiMXbnUp9Y.html Problem Link: leetcode.com/problems/find-k-pairs-with-smallest-sums/description/ Code & Notes: drive.google.com/file/d/1mhYlmkID6sMtyEcTSs1z6rCOWY-d10CG/view?usp=sharing
Bhai acche dance karte hoo aur explain bhi😁
Amazing explanation , i knew it was a min heap question but couldn't figure out how to apply it , brute force gave tle and mle
not able to open the drive link
Terrific explanation. Thank you!
Superrrrr❤
Finally understood the intuition.
Awesome explanation. Thanks dude🙌
Hi bro, what can be the optimal code for given question? There are N people who have already participated. The official has noted their weight and has ranked them. The problem is, he has fallen sick and there are still P people who are left to rank and participate. Considering this, you are expected to finish the process and provide the rank of the P people. Once the person is ranked, his weight is included in the category and the weight of the new person will have to consider this weight also to be ranked. To help you out, the new P people are organized in a queue in increasing order of their weights. Input Format The first line of input consists of two space-separated integers, N and P, number of people already ranked and number of people left to be ranked respectively. The second line of input consists of N space-separated integers arranged in decreasing order, representing the weight of the N people. The third line of input consists of P space-separated integers arranged in increasing order, representing the weight of the P people. Constraints 1
Aryan's code matches to that of other peeps
Consider the test case: nums1[1,2,3,4] nums2[1,10], k=2 for this the above approach gives incorrect answer right? As it considers only first k elements from the first list
@ok-google-run
3 ай бұрын
I think it also takes the rows into consideration
@ramprasath3818
Ай бұрын
No the code works fine ig. Initially we will have (1, 1), (2, 1) on the pq, 1) (1, 1) gets popped and added to res. (1, nums2[1]) => (1, 10) is pushed. 2) (2, 1) gets popped and added to res. Nothing will get pushed as we are at the end of the row. K = 0, and the ans is correct.
Amazing solution sir ji ❤
you are so amazingggggg!!!!!!
You got that charm on your face man !
Loved it
From the first list you are taking only 'k' elements, and Inside the while loop you are increasing the 'iterator' or 2nd list. Soo the values after kth element in list 1 are never getting used🤔 How do you know that we have to neglect them?
@piyush9409
Жыл бұрын
bcz the arrays are sorted if we find are answers then no need go go further as sthe sum increases
Amazing !!
@ARYANMITTAL
7 ай бұрын
Thank you so much ❤️🫡
I just realized that this doesn't work for negative numbers -10 ^ 5 Correct me if wrong . Sorry maybe it will work not sure .
VLOGS UPLOAD KRO BHAI
Sad it didn't workout🥲
aaj ka lc?
striver ne padhaya hota to kabhi yeh video kholni na padti. Jhel raha hu jaise taise
@Stefan_2117
6 күн бұрын
😂
but..but...but...
Bhai tum kya code explainer ke chote bhai ho 😂 ?
very confused
Explanation:240p