We have a big digital wall clock, but while hanging it on
the wall, we mounted it upside-down by mistake (i.e. the
display was rotated 180 degrees). To make
things worse, the clock has a complicated mechanism inside
that makes it go slow when it is upside-down, needing secsPerMinute
seconds to advance a minute instead of 60 seconds. Note that
even at the moment we hang the clock on the wall, this is not
necessarily set at the correct time. The
clock itself only displays hours (from 00 to 23) and
minutes (from 00 to 59), including any leading zeros.
You are given a String currentTime in
the form "HH:MM", representing the actual (correct) time at
which the clock is mounted on the wall, and a
String clockTime also in the form
"HH:MM", representing the time the clock is
displaying when it is mounted on the wall
(the time that we would see if the clock was mounted
normally, not upside-down).
Assume in both times that the seconds part is 0, i.e.,
the time just changed to currentTime and the
clock just advanced to clockTime.
You are to compute the first time after the clock is mounted on
the wall that the clock shows the correct time
(i.e., the display as shown now that the clock is mounted upside-down
represents the correct time) and return
this as a String in the form "HH:MM", including
any leading zeros. If the clock never shows the correct time,
return an empty String.
When the clock time is read upside-down, the digits
0, 1, 2, 5 and 8 are the same, 6 is shown as 9 and
9 is shown as 6. The digits 3, 4 and 7 do not show
any meaningful digits when read upside-down.
|