Great work! Wondering why we can't just initiate merged as merged = [intervals[0]] I feel like that's more readable and that way we don't need the "if not merged" check each time. Thanks!
I hated this problem. I was trying to figure out the solution without sorting and ended up with too much logic that didn’t suit all edge cases. I want to try it again without watching the rest of the video but I’ve already burned too much time
Master Data Structures & Algorithms For FREE at AlgoMap.io!
what drawing software do you use?
miro whiteboard
Great work! Wondering why we can't just initiate merged as merged = [intervals[0]]
I feel like that's more readable and that way we don't need the "if not merged" check each time. Thanks!
I did this, too. I agree, much better than running the check every iteration
thanks! Is intervals.sort() not sufficent? and why not?
I believe because you need to sort based on the 0 index of each pair so you have to declare the comparator
I hated this problem. I was trying to figure out the solution without sorting and ended up with too much logic that didn’t suit all edge cases. I want to try it again without watching the rest of the video but I’ve already burned too much time
same 😅 although I did finish this with a while loop and got 8ms runtime.
why merge[-1]
why is it your least favourite?
It's my least because the test cases they give only tell 1/10th of the story.
@@robertedwards4401 they really should just give us an example that is unordered
I just couldnt figure out the need for the .max but examples like this make it necessary:
intervals = [[1, 5], [2, 6], [3, 4]]
least favourite for a reason
bro merged[-1][1] not work
paste your code here, we troubleshoot together
@ bro do you have experience with api sql orm? I have a project using raw js and html css want to make ot work for comment part and login user