There is a museum. We know some information: there were G guards on D days. We know the guards workdays with the starting and finishing days. For example D=6 G=5 1 - 3 6 - 6 1 - 2 2 - 3 3 - 4 Questions (with answering the example): 1. How long was the longest peroid when the guard worked in museum? (Length of the longest period) answer: 3 2. How many guards were in the museum? answer: 2 3 3 1 0 1 3. On which day did the most guard work? if there are more just need the first? max pick answer: 2 4. What is the start day and the end day when less than 2 guards worked in the museum? max pick but need calculate periods again answer: 4 - 6 //start 4th end 6th but need check every days