Finding "spare time" in a day from within a list of events
- by MFB
I have a list of events which is always sorted chronologically. The start time is always followed by the end time. Times are strings formatted as 'HHmmss'.
// list of events
var events = [
'010000', // start
'013000', // end...
'053000',
'060000',
'161500',
'184500']
// desired output
var spares = [
'000000', //…