330. Patching Array | Greedy | Array | Math | Why not Bitset Trick

  Рет қаралды 6,103

Aryan Mittal

Aryan Mittal

Ай бұрын

In this video, I'll talk about how 330. Patching Array | Greedy | Array | Math | Why not Bitset Trick
Bitset Crash Course - • 3181 & 3180 | BitSet C...
Let's Connect:
📱Discord (Join Community) : / discord
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / codewitharyanbhai
💻 Twitter - / aryan_mittal007
🤖 Github: github.com/aryan-0077
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 :)
✨ Timelines✨
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms

Пікірлер: 25
@ARYANMITTAL
@ARYANMITTAL Ай бұрын
How to balance College & CP - kzfaq.info/get/bejne/bZ-iq7ljyZ6ap6s.html
@samplayz9557
@samplayz9557 Ай бұрын
You and Neetcode are the only people I understand
@brij4887
@brij4887 Ай бұрын
Good thing that this guy uploads daily, solely responsible for my streak
@toxicdemonop519
@toxicdemonop519 Ай бұрын
Aryan Bhai Aaj pehli baar leetcode contest mei 4 problems solve kiye, your segment tree video is really great, thanks a lot
@bhupendratiwari1564
@bhupendratiwari1564 Ай бұрын
can you explain 3 problem i tried with class Solution { public: bool possible(int p,int check) { if(p==check-1 || p==check+1 || p==check+2 || p==check-2) { return false; } return true; } long long maximumTotalDamage(vector& power) { sort(power.begin(), power.end()); int maxValue = *max_element(power.begin(), power.end()); long long pow=maxValue+2; vectordp(maxValue + 4, 0); for(int i=1;i=0;j--) { if (possible(power[i-1], j)) { dp[j]= max(dp[j],power[i-1] + dp[power[i-1]]); } } } return dp[pow]; } }; with this it was giving tle
@rushirajparekh9079
@rushirajparekh9079 Ай бұрын
Superb explanation!! Thank you so much Aryan! 👍
@IK-xk7ex
@IK-xk7ex Ай бұрын
THank you! Your explanation allows to grow analytical skills and setup the way of thinking about the problem. I also discovered that we can reach any `n` if the `prefixSum` of existing numbers more then `n`, but I couldn't code the solution :(
@arcade320
@arcade320 Ай бұрын
prefix sum find's us subarray sum? but here we can get through any possible combination isn't it?
@souravkumar8170
@souravkumar8170 Ай бұрын
Thank you Aryan ❤.
@Sumeet_100
@Sumeet_100 Ай бұрын
Great Explanation brother !!
@shiveshanand5812
@shiveshanand5812 Ай бұрын
beautiful explanation!
@vineethm6930
@vineethm6930 Ай бұрын
Awesome explanation man !
@prakharmuley2164
@prakharmuley2164 Ай бұрын
Some simple observation that number such as ((1
@yummytoeat3433
@yummytoeat3433 Ай бұрын
Can you write a bit of a big text
@rohita6532
@rohita6532 Ай бұрын
WHY GREEDY WORKS _TO PROVE_ ----> If the greedy algorithm needs to patch k numbers to cover [1,n] it is impossible to patch less than k numbers to do the same. _Proof by contradiction_ let's say for a given value of n and an array nums GREEDY gives x1 < x2 < x3 < ... < xk patches (total K patches) ANOTHER SOLUTION gives y1
@shivangsharma6477
@shivangsharma6477 Ай бұрын
When we add 2 then we can make 3. Now 1 and 3 van make 4 so why you add 4 here
@siddharthchaudhary2320
@siddharthchaudhary2320 Ай бұрын
Great explanation sir !! Saluting your efforts even on Sunday morning !!🫡🫡🫡
@JIGARSINGTHAKOR-yy6qp
@JIGARSINGTHAKOR-yy6qp Ай бұрын
weekly contest problem ??
@ARYANMITTAL
@ARYANMITTAL Ай бұрын
Coming sir🫡❤️
@PalakKalsi
@PalakKalsi Ай бұрын
Let him breath haha.
@JIGARSINGTHAKOR-yy6qp
@JIGARSINGTHAKOR-yy6qp Ай бұрын
@@PalakKalsi he is expert ,so he need to be quick😅
@rishiarora8123
@rishiarora8123 Ай бұрын
🫡🫡🫡
@asmitshukla4649
@asmitshukla4649 Ай бұрын
bhaiya dimag kharab hogya ye question samajhte samajhte ab pehle iska code likhunga, fir subah uth kr dry rrun krunga 2-3 baar
@abhishekshukla5747
@abhishekshukla5747 Ай бұрын
bro your english prickles my ear please work on it or speak in hindi you are so repeatitive man !!! just speak to the point and move on
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 19 МЛН
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 9 МЛН
DARKER SIDE of SOFTWARE ENGINEERING !!
12:09
Striver
Рет қаралды 133 М.
WHY did this C++ code FAIL?
38:10
The Cherno
Рет қаралды 228 М.
Coding Interviews Be Like
5:31
Nicholas T.
Рет қаралды 6 МЛН
The Algorithm Behind Spell Checkers
13:02
b001
Рет қаралды 408 М.
How To Debug React Apps Like A Senior Developer
21:07
Web Dev Simplified
Рет қаралды 63 М.
Google India Engineers in a Mock Coding Interview
15:29
Life at Google
Рет қаралды 166 М.