2 years after college I started first time greedy algorithm... Teacher or guide like you everyone wants in their start of their careers. Thank you so much Striver
@ritikkumarsingh59026 ай бұрын
Striver, your DSA Sheet is absolutely phenomenal! It's been an invaluable resource for mastering data structures and algorithms. Looking forward to the remaining topics, especially the much-anticipated sections on strings and heaps. Thanks for all your hard work!
@user-fw4kz3bb4g6 ай бұрын
do strings on your own bro, i finished it. Solutions tab in LC is more than enough
@deepkodes44342 ай бұрын
the main crux is choosing 10 5 for $20 over three 5's , take the eg below if u want 5555 10 20 10
@shwetanshu136 ай бұрын
Needed this playlist very badly.
@kathakalisaha97354 ай бұрын
i never thought greedy algo will be that easy, maybe because you are explaining it
Those who are wondering where is greedy approach in this question: suppose a customer pays 20 Rs then we first try to give him change by giving 10 Rs and 5 Rs and if are unable to do then we given three 5 Rs change , in this way saving 5 Rs for future customers.
@keshavbadhekarАй бұрын
Why aren't such helpful comments placed at the top instead of comments like 'Thank you, bhaiya... you're a god'
@Jigyarth27 күн бұрын
cool got it
@UECAshutoshKumar2 ай бұрын
Thank you 🙏
@shauryatomer10585 күн бұрын
thanks for another great video
@vighneshshankar14686 ай бұрын
I have a doubt, in this questioon we have had just 5 as cost. What if cost is user defined, then how does it work?
@Cool962676 ай бұрын
Thankyou so much Striver for all you efforts throughout in delivering us so much valuable content. Any student / working professional can now be able to transition their career without paying money for courses. Would also like your insights on the point : While preparing for interviews most of the aspirants are going through the videos solely and solving the question after completely watching the video. And also are feeling lazy trying to solve the question on our own. What is the best way to complete any topic without being lazy and how should an aspirant approach any topic/playlist?
@jritzeku5 ай бұрын
IT would be neat to have solution for larger bills as well like 100,50 etc.to see how wed need to loop inside our loop.
@Learner0106 ай бұрын
It will be great if you had explained why are we going for 10,5 first and 5,5,5 second in case of 20
@saisumanth17396 ай бұрын
It prefers to give one $10 and one $5 bill as change if possible ,because this leaves us with more $5 bills for future transactions
@ketanlalcheta45586 ай бұрын
I was about to ask why this problem falls under greedy. This question and answer help me get my answer. Thanks to both of you.. and ofcourse a big thank to striver for as usual quality content (that too free of cost)...!
@jarvis35516 ай бұрын
suppose u have five = 3 and 10 = 1, now u have bill = 20 u have 2 possibility: either give 3 five or give 1 five and 1 ten suppose u give 3 five so now u have 0 five now imagine next bill = 10 for this u need 1 five but u have already exhausted all five so u cant give a change but if u have thought greedily and have given 1 ten and 1 five then u could have given change for bill 10 also THEREFORE GREEDY IN THIS PROBLEM IS SAVING AS MANY FIVE AS POSSIBLE SO THAT WE CAN GIVE CHANGE TO MAKE BILLS
@amogu_076 ай бұрын
@@jarvis3551thanks mate!!
@tanishkarawat52666 ай бұрын
correct! Figured it out on own lol
@KKKK-pl8yf6 ай бұрын
Can we expect Stack and Queue playlist by end of this month or next month ?
@oppie3355 ай бұрын
Studying greedy you became greedy bruh😂
@yassenfathi5264 ай бұрын
It's out bro
@catlord777x34 ай бұрын
I think the quality of Video have decreased!! B'coz comming up with this solution is nothing, but I was hopping for this question or solving was involving greedy technique and mindset, that help us also understand greedy rather superficial definition
@kartikeykatyal78166 ай бұрын
we want string playlist
@utkarshsingh093 ай бұрын
Understood Sir!
@Serenity_BoyАй бұрын
class Solution { public: bool lemonadeChange(vector& bills) { int five = 0, ten = 0; // Initialize ten to 0 for (int i = 0; i < bills.size(); i++) { if (bills[i] == 5) { five++; } else if (bills[i] == 10) { if (five) { five--; ten++; } else { return false; } } else { // bills[i] == 20 if (five && ten) { five--; ten--; } else if (five >= 3) { five -= 3; } else { return false; } } } return true; } };
@teeyaojha43655 ай бұрын
please add link to this video in a2z sheet it just shows coming soon
@MJBZG3 ай бұрын
super easy, understood
@KartikeyTT6 ай бұрын
ty sir
@sanchitdeepsingh96635 ай бұрын
Thanks sir
@Shivi325904 ай бұрын
thank you
@pranavmisra58705 ай бұрын
Understood
@066_PRAVEENR-rl6py2 ай бұрын
I dont how it's working.....😢
@AdityaSrivastava-x3r4 ай бұрын
Bhiya pahle wala style se padhaiye . Pahle aap different platform ( GFG , Leetcode) se problem statement show kar ke padhate the to jayada samjh me aata tha 😢😢😢 abhi thoda problem hota hai
@Flash-qr5oh5 ай бұрын
int lemonadeChange(vector bills) { int five = 0, ten = 0; for (int i : bills) { if (i == 5) five++; else if (i == 10) five--, ten++; else if (ten > 0) ten--, five--; else five -= 3; if (five < 0) return false; } return true; }
@subee1285 ай бұрын
thanks
@harshitjaiswal94395 ай бұрын
understood
@ayushgaurabh86045 ай бұрын
awesome
@learnergood4 ай бұрын
Hi Striver, How to find out for the problem we have to use greedy algorithm?
@KartikeyTT5 ай бұрын
C++ Solution of above video class Solution { public: bool lemonadeChange(vector& bills) { int five=0; int ten=0; for(int i=0; i=1 && five>=1){ ten--; five--; } else if( five>=3){ five-=3; } else{ return false; } } else{ five++; } } return true; } };
@StudyYuv4 ай бұрын
thanksss bro
@saurabhkumaryadav389227 күн бұрын
3:36 i have 2 10s but i dont have zeo wrong said it will be i don't have 5 will be there
@harshalgarg16763 ай бұрын
US
@jeethora5865 ай бұрын
strings pleaseeeeeeeeee
@lofi_feels19246 ай бұрын
Are y har video m string string krna jruri h kya ispe s lgta ki tum log yaha bhi spoon feeding le rahe ho🙂