The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 4 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Given two times when seen on a digital clock, count the number of moments between these two times (both start and end time included) when the time was a palindrome.
A digital clock shows time in the format HH:MM:SS (hours:minutes:seconds).
For example, 2:40:38 pm is represented as 14:40:38.
The first line contains q queries.
This is followed by q lines each containing two time strings, t1 and t2, which are 6 digit integers that represent times shown by a digital clock. It is ensured that t1 and t2 are valid times.
Â
Â
Input: 4 00:00:01 00:00:01 09:09:09 13:34:57 11:11:11 11:11:11 02:38:15 03:01:16 Output: 0 22 1 3
Â
Case 1: Only 1 moment is considered in this case, i.e., 00:00:01. We can clearly see that 00:00:01 is not a palindromic string.
Case 4: Between 02:38:15 and 03:01:16, there are 3 moments that are palindromic strings. They are 02:44:20, 02:55:20 and 03:00:30.
Note that the time as seen on a digital clock should appear as a palindrome. 1 is a palindrome, but 00:00:01 on a digital clock is not.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll