MERGE INTERVALS || LeetCode 56 || Hindi Solution
Vložit
- čas přidán 23. 05. 2021
- Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. Question Name:
MERGE INTERVALS
Question Statement:
1. Given an array of Intervals , return merged overlapping intervals.
2. For more detail watch the video.
Topic: #Array #Sort #Scheduling #OOPS
Used #DataStructure: #Arrays #Lambda Expression
#TimeComplexity: O(nlogn)
#SpaceComplexity: O(n)
--------------------------------------------------------------
Smimilar Questions: N/A
---------------------------------------------------------------
For detailed information and other exercises, VISIT: www.pepcoding.com
Have a look at our result: www.pepcoding.com/placements
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
----------------------------------------------------------------
#Array #Sort #Lambda_Expression #LeetCode #Array-and-String #GfG
For a better experience and more exercises, VISIT: www.pepcoding.com/resources/o...
Have a look at our result: www.pepcoding.com/placements
Follow us on our CZcams page: / pepcoding
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
Follow us on Pinterest: / _created
Follow us on Twitter: home
.
.
.
Happy Programming !!! Pep it up 😍🤩
.
.
.
#pepcoding #code #coder #codinglife #programming #coding #java #freeresources #datastrucutres #pepcode #competitive #competitiveprogramming #softwareengineer #engineering #engineer
amazing....
clear and easy explanaton
Outstanding Explanation Sir...
Best explanation ❤ Thankyou sir
Best Explanation ever !!!
God level Expalination!
bhiya best explanation
Thank You
bestest explaination ever vedio esi pure u tube pe explaination ni h esi, vedio half dekhte hi subscribe kar diya, osam bro, keep it up.
Kudos to pepcoding
One of the most underrated channels out there! Always the code is written in an easy-to-read and understandable manner! The explanation was also excellent!
Thank you for the great explanation, btw
Sorting algo = positive means swap the value, negative and zero means no swap...
Best and easiest explanation of merge interval question on CZcams.
itna detail me samzhaya h ki code first time me hi run ho gya mera, thanks
Hands down the best explanation for this question. Covered every aspect of the problem and the code in detail. Kudos to you and thank you!!💯💯
Puraa IT ilaka aap to DuuuAaan DuuuAaan kr diye..... Mst explanation
very well explained and easiest solution out of all videos I watched. Thank you so much
I have not seen this kind of explanation on CZcams .. really helpful sir..
Best solution ever on you tube 💯💯💯
The best explanation available on the internet.
Great great great explanation sir best teacher 👍👏👌😀🙌😊
So detailed explanation hatss offf mannnnn
One of the best explanations on this.
Best Solution ever !! , thank you @pepcoding
for leetcode use interval[0]
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
Excellent explanation. Great work!!
Literally this is the best and detailled explanation ever for this problem......🙌🙌🙌
you are amazing. I couldn't find a better solution to this question.
kya khoob smjha rhe ho bhai ! Mindich blowing
Glad you liked it!
For better experience, visit nados.io, where you will get well curated content and career opportunities.
Explanation is 🔥🔥🔥
Best tutorial i have ever seen in my entire life ..❤️
very good explanation loved it sir
Nothing batter than this, such a great explanation
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
If you like our efforts, we request a review
g.page/Pepcoding/review?rc
You can subscribe to our channel here
czcams.com/users/Pepcodingabout?view_as=subscriber
For clearing your doubts, you can join our community on telegram
t.me/pepcoding
Please provide solutions in cpp, it will be helpful
you are amazing. thank you sir 🤗
Glad you liked it!
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
hatsoff bro I am too preparing for placements
Mohit bhaiya excellent explanation.
amazing bhai❤❤
Thanks great explanation but we can optimise it in O(n) i.e. without sorting it
Excellent explanation sir🔥🔥🔥
Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
100 times clapping bhai for you
i salute u
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
Excellent explanation. Great work!! ❤️❤️❤️❤️❤️❤️😍😍😍
Glad you liked it! For better experience and well organised content sign up on nados.io
You can also post your queries on community section of NADOS.
Thank you! Cheers!
Sign up on nados.io today. You will get the better experience and precisely arranged content.
it is best explanation sir thanku very much
So nice of you and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Great explanation
Glad it was helpful! and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
in the code at line 18 there should be
Just wow. U shud come and teach very often sir. u are too good
wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.
@@Pepcoding sure sir🙏
what is the TC of this solution ?
bhaiiiiisaaab mazaaa agya .....notes bhi banane ki zarurat nhi padhi.... best explanation bhaiya 👌👌👌💯
Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
thank you fir such a brief explanation about everything......that somehow motivates me a lot.
what is the TC of this solution ?
@@freshcontent3729 O(N)
very well explained brother . Thanks for your hard work . keep it up.
Hope you love the explanation, for better experience and well organised content sign up on nados.io and start learning.
Sir exellent explanation 👌👌👌
Thanks and welcome Keep watching
Very good explanation
Thanks for liking and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
it should be interval[0]
yes you are correct otherwise it might be a fail in some test cases
yes it depend on the condition in the question
yes exactly!
explanation of mohit sir is so good that this video has 0 dislikes
Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Great
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
If you like our efforts, we request a review
g.page/Pepcoding/review?rc
You can subscribe to our channel here
czcams.com/users/Pepcodingabout?view_as=subscriber
Sorting--->
public class Sorting {
public static int[][] checkSort(int Interval [][]){
Arrays.sort(Interval,(a,b) -> Integer.compare(b[0], a[0]));
System.out.println(Arrays.deepToString(Interval));
return Interval;
}
public static void main(String[] args) {
int arr[][] = {{6,8},{1,9},{2,4},{4,7}};
checkSort(arr);
}
}
nice nice very very nice
gajaaab
bahut badiya
aur taarif karna ka liaa words nahi bachhhhahahahaahah
Glad to know that you liked the content and thank you for appreciating.
The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
So, keep motivating, keep learning and keep loving Pepcoding😊
Mohit sir OP ❤️❤️
Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
can anyone mention ful name of mohit sir , so that i can connect with him on linkedin
mohit behl
Sir One Doubt you told that interval [0]
bhai aisa isliye ho raha qki leetcode platform p jo question h usme = k sign ko consider karna hai but pepcoding k platform p jo question h usme = sizn ko consider nhi krna.
class Solution {
public:
vector merge(vector& intervals)
{
vectormergedIntervals;
sort(intervals.begin(),intervals.end());
for(auto interval:intervals)
{
if(mergedIntervals.size()==0)
{
mergedIntervals.push_back(interval);
}
else
{
vectorpreinterval = mergedIntervals.back();
if(interval[0]
Can we use stack here?
sir i have a doubt actually its not question specifically but when you taken the last element arraylist in prevlist and do the updates on prevlist accordingly but the arraylist getting updated automatically can u explain why its happening???pls help
Same Dought
Same doubt
Every other video on this topic it's Max 17 minutes. This one is 37 minutes giving detailed explanation hats off
One doubt: Last Line: list.toArray(new int[list.size()][]); takes extra time/memory to convert?
It makes a deep copy or shallow copy?
Would it be better if we create a 2-d array instead of arraylist and use normal for loop for indexing?
yeah I was also wondering the same... but then memory would be wasted as intervals are merged and we don't know how many intervals would be there once we merge it....
@@snehaashishgupta1254 you dont need to worry about that because list.toArray makes shallow copies so we are safe. It creates a list of pointers which are pointing towards 1d arrays present in heap.
@@muditjain9117 ok
@@muditjain9117 so basically shallow copies are pointing to heap while deep copies are made in the the stack with a separate object in heap
@@snehaashishgupta1254 yes.
ezzzy pizzy lemon squezzy o O
Very Low Volume Sir
algorithm csgo remember bro😂
Please use white board