You are viewing a single comment's thread. Return to all comments →
My typescript solution:
let maxCount = 0; let lastTwo = [[0,0],[0,0]]; intervals.sort((a,b) => a[1]-b[1]); intervals.forEach((interval) => { if(interval[0] > lastTwo[1][1]) { maxCount++; lastTwo[1] = interval; } else if (interval[0] > lastTwo[0][1]) { maxCount++; lastTwo[0] = interval lastTwo.sort((a,b) => a[1]-b[1]) } }) return maxCount;
Seems like cookies are disabled on this browser, please enable them to open this website
Interval Selection
You are viewing a single comment's thread. Return to all comments →
My typescript solution: