Editorial for CCC '17 J4 - Favourite Times
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
For out of the available marks , we can simply iterate over every possible time as displayed on the clock face and check if the digits form an arithmetic sequence, taking care to ignore the leading zero in the hour as required.
Time Complexity:
For the full marks, we make the observation the analog clock cycles through its faces in hours, or minutes, meaning we only need to compute the amount of times an arithmetic sequence is formed within the first hours after in the worst case. To obtain our answer, we can multiply the maximum number of times an arithmetic sequence is seen in the hour interval by and add the amount of time an arithmetic sequence is seen in the time left over.
Time Complexity:
Comments