write a merge function
[
{ start: 1, end: 2 },
{ start: 2, end: 3 },
{ start: 5, end: 6 },
{ start: 3, end: 5 },
{ start: 8, end: 9 },
]
The parameter is an array
if the parameters only have {start: 1, end: 2},
{start: 2, end: 3} merge into {start: 1, end: 3} and then return the array [{start: 1, end: 3}]
if parameters {start: 1, end: 2},
{start: 2, end: 3} {start: 5, end: 6}
return the array [{start: 1, end: 3}, {start: 5, end: 6}]
at this time.if the parameter is
[
{ start: 1, end: 2 },
{ start: 2, end: 3 },
{ start: 5, end: 6 },
{ start: 3, end: 5 },
{ start: 8, end: 9 },
{ start: 11, end: 15 },
]
return [{start: 1, end: 6}, {start: 8, end: 9}, {start: 11, end: 15}]