Problem Statement | |||||||||||||
During the week, the cafeteria of my university is open until 2:30 PM. Normally, I will be at the university before this time anyway. Since I am a lazy person, I don't want to cook for myself and prefer eating in the cafeteria. But sometimes I don't have any classes in the morning, so I have to make sure to get to the university before the cafeteria closes. There are several bus stops within walking distance of my home and each one has a bus connection to the university. For each bus stop, there will be a bus driving to the university every ten minutes, so I just need to remember the number of minutes after a full hour when the first bus departs from each stop, how long it takes to get to the bus stop and how long the bus needs to drive to the university. Given a int[] offset (the number of minutes after a full hour when the first bus departs), int[] walkingTime (the number of minutes I need to walk to a bus stop) and a int[] drivingTime (the number of minutes the bus needs to drive to the university) you should write a method that returns the latest time when I have to leave my house in order to be at the university at 2:30 PM or before. The ith element of offset, walkingTime and drivingTime refers to the ith bus stop. The format of the returned time should be HH:MM (HH the hour, MM the minute). The 12 hour time format is used (see examples). | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | Times between noon and 1 PM should be written as 12:MM (where MM is the number of minutes after noon). | ||||||||||||
Constraints | |||||||||||||
- | offset, walkingTime and drivingTime contain the same number of elements. | ||||||||||||
- | offset, walkingTime and drivingTime contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of offset is between 0 and 9, inclusive. | ||||||||||||
- | Each element of walkingTime is between 1 and 30, inclusive. | ||||||||||||
- | Each element of drivingTime is between 1 and 300, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|