1
var intervalIntersection = function (firstList, secondList) {2
//if a overlap b - a.start >= b.start && a.start <= b.end3
//if b overlap a - b.start >= a.start && b.start <= a.end5
//handle empty edge cases6
if (firstList.length === 0 || secondList.length === 0) {13
while (i < firstList.length && j < secondList.length) {15
firstList[i][0] >= secondList[j][0] &&16
firstList[i][0] <= secondList[j][1];18
secondList[j][0] >= firstList[i][0] &&19
secondList[j][0] <= firstList[i][1];21
if (a_overlap_b || b_overlap_a) {22
let start = Math.max(firstList[i][0], secondList[j][0]);23
let end = Math.min(firstList[i][1], secondList[j][1]);24
merged.push([start, end]);27
if (firstList[i][1] < secondList[j][1]) {