function sortArrays(arr) { return arr.sort((a, b) => a[0] - b[0]); } function mergeIntervals(arr) { let newArr = [arr[0]]; for (const [start, end] of arr) { let lastEnd = newArr.at(-1)[1]; if (start
I didn’t check but at first glance, the bug is in line 16 - should be intervals[i][0]. Also I’m not sure if you need to take a min at line 17 since you already sorted the array
Cliffhanger ending
seriously lmao
code is working fine must be a glitch
Loool, I just saw this comment and went back to the video. Sorry about that haha but thanks for pointing it out! 😅
Great explanation, please do more of these type of videos, maybe solving all of blind 75 in javascript
appreciate it!
Amazing explanation !!
function sortArrays(arr) {
return arr.sort((a, b) => a[0] - b[0]);
}
function mergeIntervals(arr) {
let newArr = [arr[0]];
for (const [start, end] of arr) {
let lastEnd = newArr.at(-1)[1];
if (start
I didn’t check but at first glance, the bug is in line 16 - should be intervals[i][0].
Also I’m not sure if you need to take a min at line 17 since you already sorted the array
It’s in the if statement
Shouldn't i = 0?
already added zero indexed array in result so no need to start from 0