Digits on a clock
Write code · Medium · §7.1 Trying them all
A digital clock shows the time as HH:MM, using two digits each for the hour and the minute (for example, 09:05).
Consider every time, one per minute, from 00:00 up to and including h:59 (for example, up to 05:59 when h is 5). Complete the function solution, which returns how many of these times contain the digit d at least once.
Function
solution(h, d)
Constraints
his an integer from 0 to 23.dis an integer from 0 to 9.
Examples
| h | d | result |
|---|---|---|
0 | 5 | 15 |
1 | 1 | 75 |
Starter code
def solution(h, d):
answer = 0
return answerSolve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.