Тёмный

L7. N Meeting in One Room | Greedy Algorithms Playlist 

take U forward
Подписаться 681 тыс.
Просмотров 34 тыс.
50% 1

Find problem link, notes under Step 12: takeuforward.o...
Follow me on socials: linktr.ee/take...

Опубликовано:

 

29 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 42   
@KrishnaPatil-qj5qw
@KrishnaPatil-qj5qw 3 месяца назад
Kijiye Meeting Meeting, karte rahiye meeting meeting, alhua meeting meeting
@TheLearningLab898
@TheLearningLab898 2 месяца назад
🤣
@tusharyadav5874
@tusharyadav5874 Месяц назад
Its not halua meeting , its alhua (sweet potato )
@KrishnaPatil-qj5qw
@KrishnaPatil-qj5qw 27 дней назад
@@tusharyadav5874 Ouhh, I just went with the feel😂
@ToonDubberDuo
@ToonDubberDuo 4 дня назад
i could solve it using the overlapping intervals concept, felt great lol
@naveensingh596
@naveensingh596 Месяц назад
Such a great explanation !
@LuckyKumar-mt9km
@LuckyKumar-mt9km 3 месяца назад
int maximumMeetings(vector &start, vector &end) { vector v; int n = start.size(); for(int i=0;i time) { ans++; time = item.second; } } return ans; } int this code , i dont need to store the position anywhere , just store both of those in a vector of pairs, i think this code is better than the given video
@after_dark_777
@after_dark_777 3 месяца назад
It's not better, as the space complexity is now O(n^2) rather than O(n) in the solution
@ghufran_khan_
@ghufran_khan_ 2 месяца назад
@@after_dark_777 bro space complexity is O(2n) not O(n^2)
@KartikeyTT
@KartikeyTT 3 месяца назад
tysm sir
@harshitjaiswal9439
@harshitjaiswal9439 3 месяца назад
understood
@solvinglife6658
@solvinglife6658 3 месяца назад
Stacks
@harshitvh1
@harshitvh1 3 месяца назад
Easy java solution: public static int maxMeetings(int start[], int end[], int n) { List list = new ArrayList(); for(int i=0;i lst.get(2))); int freeTime = 0; int count = 0; for(int i=0;i
@rishitkamboj8078
@rishitkamboj8078 3 месяца назад
static class meeting{ int start; int end; public meeting(int s,int e){ this.start=s; this.end=e; } } public static int maxMeetings(int start[], int end[], int n) { meeting m[]=new meeting[n]; for(int i=0;ia.end-b.end); int count=0; int prev=0; int s=0; int e=0; for(int i=0;im[prev].end){ // count++; // prev=i; // } if(m[i].start>e){ count++; e=m[i].end; } } return count; }
@sajalkumarsingh9839
@sajalkumarsingh9839 3 месяца назад
a better code static bool cmp(pair a,pair b){ return a.second
@OrbitZyro
@OrbitZyro Месяц назад
Another way to think about this is to sort by start time in asc order. While keeping track of lastEnd time, when evaluating times[i] , there are 2 cases 1. there is no overlap; - update lastEnd time to times[i][1] - count++ 2. there is an overlap ( times[i][0]
@vibhasyadav980
@vibhasyadav980 2 месяца назад
@takeUforward I have a question regarding this. Why minimum platform doesnt work here? I mean if I try to calculate minimum meeting rooms and then assign 1 meetings to each of one rooms and rest to just one room
@aruna5869
@aruna5869 15 дней назад
I am feeling like intuition is missing in this problem... does anyone same like me?
@UECAshutoshKumar
@UECAshutoshKumar 11 дней назад
Thank you
@top_g755
@top_g755 4 месяца назад
How can u say that greedy will always work
@suhanapriya7070
@suhanapriya7070 4 месяца назад
Yayyy!
@naveen_satyarthi
@naveen_satyarthi 20 дней назад
struct Meeting{ int start; int end; int pos; }; bool meetingComparator(Meeting m1, Meeting m2) { if(m1.end < m2.end) return true; else return false; } class Solution { public: int maxMeetings(int n, int start[], int end[]) { vector meetings(n); for(int i = 0; i < n; i++){ meetings[i].start = start[i]; meetings[i].end = end[i]; meetings[i].pos = i+1; } sort(meetings.begin(), meetings.end(), meetingComparator); // sort according to the end time.. int freetime = meetings[0].end; int count = 1; for(int i = 1; i < n; i++){ if(freetime < meetings[i].start){ count++; freetime = meetings[i].end; } } return count; } };
@abhishekkumar-ot4zo
@abhishekkumar-ot4zo 18 дней назад
this might not work for the case in which there is no 0-5 and no 1-2 and it has 0-2 removing the two inputs which are 0-5 and 1-2 and adding the input 0-2 will it work or not clarify it
@CryptoBoy0111
@CryptoBoy0111 Месяц назад
C++ CODE struct meet{ int start; int end; }; class Solution { public: // Function to find the maximum number of meetings that can // be performed in a meeting room. static bool comp(meet m1,meet m2){ return m1.end
@SibiRanganathL
@SibiRanganathL 16 дней назад
Understood
@muntajir646
@muntajir646 2 месяца назад
Simple Java Code For Only Meeting Count: class Meeting{ int start; int end; public Meeting(int s, int e){ this.start=s; this.end=e; } } class Solution { public static int maxMeetings(int start[], int end[], int n) { List meetings = new ArrayList(); for(int i=0; i m.end)); int lastEnd= -1; int count=0; for(Meeting meet: meetings){ if(meet.start > lastEnd){ lastEnd=meet.end; count++; } } return count; } }
@palgravedmen8519
@palgravedmen8519 4 месяца назад
Goat is back
@deveshsharma-u2l
@deveshsharma-u2l 2 месяца назад
Striver after eating mummy ke haath ka khaana abhi kitne video banane hai bana lenge sab hojayega ,welcome back
@Dsa_kabaap
@Dsa_kabaap 4 месяца назад
Sir please start making videos on strings and stacks
@meme_eternity
@meme_eternity 3 месяца назад
Understood
@darkfallmotivation5687
@darkfallmotivation5687 2 месяца назад
As you said sort the array based on meeting timing, and process the problem of sorting values, for example if the shortest meeting starts at 20 and other meeting timings are lesser than 20, how would this approach work?
@siddhantshukla2154
@siddhantshukla2154 2 месяца назад
Sorting on basis of ending times, not on the actual length.
@thoughtsofkrishna8963
@thoughtsofkrishna8963 3 месяца назад
Waiting for strings playlist
@sword013
@sword013 2 месяца назад
Why is
@avengergirl_0464
@avengergirl_0464 17 дней назад
Bcoz it is given in problem statement that the start time of other meeting cannot be equal to end time of prev meeting..it must be greater
@RachitKala-cp4uh
@RachitKala-cp4uh 2 месяца назад
Understood
@subee128
@subee128 Месяц назад
Thanks
@subhasreebanerjee98
@subhasreebanerjee98 4 месяца назад
Please also include code explanation in c++ which you used to do, that would be really helpful!
@subratamandal2924
@subratamandal2924 Месяц назад
Hey Bengali. Which college currently are you in?
@Professor-du2pf
@Professor-du2pf 4 месяца назад
std :: cout
@Anonymous____________A721
@Anonymous____________A721 Месяц назад
return "so_what";
Далее
L6. Job Sequencing Problem | Greedy Algorithm Playlist
16:07
+1000 Aura For This Save! 🥵
00:19
Просмотров 11 млн
LeetCode was HARD until I Learned these 15 Patterns
13:00
Minimum Platforms | Greedy Algorithms
18:41
Просмотров 170 тыс.
L11. Valid Parenthesis String | Multiple Approaches
26:09
L4. Jump Game - I | Greedy Algorithm Playlist
10:53
Просмотров 45 тыс.
L9. Insert Intervals | Greedy Algorithms Playlist
13:16