in both the cases there is one thing common to be pointed out that both cases that array should be sorted according to ending points class Solution { public: static bool comp(vector a, vector b){ return a[1]
in your first example you said intervals are not overlapping but they are overlapping so please modify that example otherwise students will get confused
very good explanation my code for same :- sort(intervals.begin(),intervals.end()); int n = intervals.size(); vector temp(2,0); temp[0]= intervals[0][0]; temp[1]= intervals[0][1]; int count =0;
for(int i = 1 ; i < n ; i++) {
int currst = intervals[i][0]; int currend = intervals[i][1];
if( currst < temp[1]) //overlapping {
count++;
//check for full merge overlapping then update the temp if(currst > temp[0] && currend < temp[1]) {
in both the cases there is one thing common to be pointed out that both cases that array should be sorted according to ending points
class Solution {
public:
static bool comp(vector a, vector b){
return a[1]
ek to itni cute ,uper se coder ...haaye jaan hi logi kya 😇🥰❤❤
Very very very good explanation! Thank you so much!!!
Thanks, ma'am for the simple explanation. I was stuck with the implementation for a long time.
in your first example you said intervals are not overlapping but they are overlapping so please modify that example otherwise students will get confused
See whole video
Thanks for explaining in this very intutive way
very good explanation my code for same :-
sort(intervals.begin(),intervals.end());
int n = intervals.size();
vector temp(2,0);
temp[0]= intervals[0][0];
temp[1]= intervals[0][1];
int count =0;
for(int i = 1 ; i < n ; i++)
{
int currst = intervals[i][0];
int currend = intervals[i][1];
if( currst < temp[1]) //overlapping
{
count++;
//check for full merge overlapping then update the temp
if(currst > temp[0] && currend < temp[1])
{
temp[0]= currst;
temp[1]=currend;
}
}
else //non overlapping just update the temp
{
temp[0]= currst;
temp[1]=currend;
}
}
return count;
}
The leetcode description was not very clear to me so i misunderstood and applied Lis which ran few test cases but this was very helpful .
Thanks. Very good explanation.
Amazing Explanation !!
Love (u) the way u teach ❤❤
Feeling Laughs with proverb:" Killing 1 bird with 2 stones "
Cruel 😖
great explanation
yrrr tum kitni cute ho...dayum beauty with brains....
She wants me
The first example which u took [1,5],[3,8],[10,15]. Here 3 is actually overlapping but u told it's not
Anyways u cleared in further video
Yes Milind, thanks for pointing it out, took the wrong example : )
abe saale milind jab clear ho gya tha tujhe toh comment karne ki kyu khujli hori
tysm nicely explained
Thanks a lot
mam are you alive 🙄
Thank you diiiiiiii
got it
are u in a hurry to go somewhere why are u explaining it very fast focus on that
😮