You have an array of working time period pairs (from, till) received from user input and written according 24-hour clock format convention. You have to merge these periods if the intersect each other.
For example, if you have (10, 12), (11, 13), (12, 14) you should merge them into (10,14). Also (23, 0) and (0, 1) should be merged into (23, 1).
UPDATE:
@dmckee Let assume that the set of pairs like (10:00, 12:00) is the valid input.
@dude We don't consider Sundays and holidays so all merges should be performed for the common twenty-four hours range.
@steven-rumbalski The result of (0,8), (8,16), (16,0) may be any (x,x) pair, for example, (00:00,00:00).
Example 1
Input
(09:00,12:00),(11:00,13:00),(17:00,19:00) Output
(09:00,13:00),(17:00,19:00) Example 2
Input
(00:00,08:00),(08:00,16:00),(16:00,00:00) Output
(00:00)
(10,12)a valid input, or should it be(10:00, 12:00)or something similar? Likewise, what is the correct format for the output? Also each challenge should specify what the metric is (i.e. we don't only do [code-golf] or even default to it). \$\endgroup\$(0,8), (8,16), (16,0)be? \$\endgroup\$