Question 2
Question 2
And, the digital clocks use the binary numbers for telling the times.
Consider the input 0001 0010 0011 0101. There are 4 sequences of
the input and each sequence has 4 binary numerals. Each sequence
of the input is separated by a whitespace. The first 2 sequences
represent the hour and the remaining 2 sequences represent the
minutes. The first sequence of the input is 0001 which is decimal
number 1 and second sequence is 0010 translating as decimal
number 2. Thus the first 2 sequences represent the Hours of the
time which is 12. In the similar fashion, the last sequences can be
decoded as decimal number 35. Therefore, the input refers to the
time 12:35.
Note: The input represents a 24-hours time format and not the 12-
hour time format.
Function Description
Constraints
The input should not breach the clock constraints, That is, it should
be not be negative and cannot accept input greater than 24 hours.
▼Input Format For Custom Testing
▼Sample Case 0
Sample Output
12:35
Explanation
The first 2 sequences represent the hours of the time and translate to decimal number 12. The last 2
sequences represent the minutes and translate to decimal number 35. Thus the input represents the
time 12:35 on the clock.
▼Sample Case 1
A
Sample Output
Invalid input
▼ Sample Case 1
Sample Output
Invalid input
Explanation
Carefully notice that the first sequence is 00.11 which represents decimal number 3 and the last
sequence represent decimal number 13. Both these numbers are out of bounds for a valid time on
the clock. Thus, the above error.