1509. Minimum Difference Between Largest and Smallest Value in Three Moves | Heap | Sorting | Greedy

  Рет қаралды 5,846

Aryan Mittal

Aryan Mittal

Күн бұрын

In this video, I'll talk about how to solve Leetcode 1509. Minimum Difference Between Largest and Smallest Value in Three Moves | Sorting | Greedy
Let's Connect:
📱Discord (Join Community) : / discord
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / codewitharyanbhai
💻 Twitter - / aryan_mittal007
🤖 Github: github.com/ary...
About Me:
I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms

Пікірлер: 28
@purushottamnitwarangal9263
@purushottamnitwarangal9263 2 ай бұрын
I think there is better approach without using any higher order data structure as below : int minDifference(vector& nums) { sort(nums.begin(),nums.end()); int n=nums.size(); int ans=INT_MAX; if(n
@user-rk9pk9dm4z
@user-rk9pk9dm4z 2 ай бұрын
Your Teaching Style is Awesome!!! In love with data structures... & appreciate your consistency of uploading daily videos. Keep Going Bruh.. Well wishes.....
@varunjain3947
@varunjain3947 2 ай бұрын
Thankyou bro i couldn't understand this question earlier but you really make it so simple
@brp3522
@brp3522 2 ай бұрын
9:23 *Holiday bgm playinh*
@cenacr007
@cenacr007 2 ай бұрын
Keep up the good work, your daily videos motivate e to do leetcode daily
@italk-gj5kk
@italk-gj5kk 2 ай бұрын
salute to your efforts for providing an optimised code as well...
@sanketbhagat1222
@sanketbhagat1222 2 ай бұрын
Thanks for providing quality content.
@naveroo11
@naveroo11 2 ай бұрын
class Solution { public: int minDifference(vector& nums) { int n = nums.size(); if(n
@qwerty_ra_ungamma
@qwerty_ra_ungamma 2 ай бұрын
Bro, Improve the Audio quality🙂🙂
@ARYANMITTAL
@ARYANMITTAL 2 ай бұрын
Yaa it is pretty bad this time, i'll surely correct it ❤
@bhamidipatisatwik1165
@bhamidipatisatwik1165 2 ай бұрын
just want to know the difference in time and space complexity between nth element and partial_sort approach in c++ vs this approach afaik nth element in c++ uses partition method of quick sort so i think time complexity is same as this and what about space complexity
@manishprasad8736
@manishprasad8736 2 ай бұрын
Thank you bhai!! Great explanation!!
@abytespaceneeded
@abytespaceneeded 2 ай бұрын
💝💝💝💝
@hardikpatel352
@hardikpatel352 2 ай бұрын
Thanks a lot
@santhosh7042
@santhosh7042 2 ай бұрын
bhaiya please explain the binary search approach
@asthajain2511
@asthajain2511 2 ай бұрын
Your efforts sir😇
@user-fl5sw8op1g
@user-fl5sw8op1g 2 ай бұрын
its crazy i was looking for this only
@user-fl5sw8op1g
@user-fl5sw8op1g 2 ай бұрын
wait its qs of the day
@ayaaniqbal3531
@ayaaniqbal3531 2 ай бұрын
bro can we also do the above problem in O(N) Time Complexity ?
@6mahine_mein_google
@6mahine_mein_google 2 ай бұрын
heap approach is in O(N) time
@ayaaniqbal3531
@ayaaniqbal3531 2 ай бұрын
@@6mahine_mein_google i don't think so because a single element take logN and N element will take NlogN
@6mahine_mein_google
@6mahine_mein_google 2 ай бұрын
@@ayaaniqbal3531 here logN factor comes in because of the size of the heap but heap size is never more than 4 which means TC is Nlog4 , u can omit log4 as its a constant , thats why TC is O(N)
@ayaaniqbal3531
@ayaaniqbal3531 2 ай бұрын
@@6mahine_mein_google but bro that is space complexity and I am talking about Time complexity because to get that four element we have to go to each aray element and thus NlogN
@vickyroy3595
@vickyroy3595 2 ай бұрын
Aryan Missing Goldman sachs Tee!!😂❤
@30sunique78
@30sunique78 2 ай бұрын
☕ Tea or Tee ?
@AdityaDhage-1603
@AdityaDhage-1603 2 ай бұрын
1st Comment
@ARYANMITTAL
@ARYANMITTAL 2 ай бұрын
❤️❤️🫡
@worldofgaming748
@worldofgaming748 2 ай бұрын
itni garmi mein ye kya phn rakah hai
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1 МЛН
هذه الحلوى قد تقتلني 😱🍬
00:22
Cool Tool SHORTS Arabic
Рет қаралды 104 МЛН
SCHOOLBOY. Мама флексит 🫣👩🏻
00:41
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 7 МЛН
МЕБЕЛЬ ВЫДАСТ СОТРУДНИКАМ ПОЛИЦИИ ТАБЕЛЬНУЮ МЕБЕЛЬ
00:20
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 141 М.
AI can't cross this line and we don't know why.
24:07
Welch Labs
Рет қаралды 331 М.
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 222 М.
I Parsed 1 Billion Rows Of Text (It Sucked)
39:23
Theo - t3․gg
Рет қаралды 134 М.
WHY IS THE HEAP SO SLOW?
17:53
Core Dumped
Рет қаралды 223 М.
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1 МЛН