An electronic clock shows hours and minutes: from 00:00 to 23:59.

enter image description here

Sort the numbers 0, 1, ..., 9 according to the time of their presence on the clock board during the 24-hours.

Edit For example, for the 1-minute time period of showing 14:44, you should count it as one minute of 1 and 4 each.

  • $\begingroup$ The question seems a little unclear. $\endgroup$ Nov 26, 2020 at 3:28
  • 2
    $\begingroup$ Can you elaborate on "time of presence"? For example, for the 1-minute time period of showing 14:44, do you count it as one minute of 1 and three minutes of 4, or one minute of 1 and 4 each? $\endgroup$
    – Bubbler
    Nov 26, 2020 at 3:30
  • $\begingroup$ I think you mean number of times present. $\endgroup$ Nov 26, 2020 at 3:32
  • $\begingroup$ @PrinceDeepthinker It still doesn't answer my question, as it is unclear whether we should count three 4's showing at once as three appearances or just one. $\endgroup$
    – Bubbler
    Nov 26, 2020 at 3:34
  • $\begingroup$ @Bubbler, in you example, for the 1-minute time period of showing 14:44, one should count it as one minute of 1 and 4 each. $\endgroup$
    – Nick
    Nov 26, 2020 at 3:40

2 Answers 2


Since we are only asked to sort, not give actual counts, there is an easy proof that

the order (most frequent to least frequent) is just 0,1,2,...
Indeed, for each valid time containing digit d+1 but not d, the time with every d+1 replaced with d is also valid and this association is unique; hence d must be counted at least as often as d+1.
Note that the photo in OP is a crucial hint because it clarifies that the clock shows leading zeros. This is necessary for the proof to work (and for the statement to hold) for d=0.


Without the tag, I just wrote a short program and here is the output:

900, 900, 630, 495, 450, 450, 252, 252, 252, 252

These are the number of minutes of 0 - 9.

Here is the Python program:

s = [0] * 10
for a in range(24):
    for b in range(60):
        for m in {a // 10, a % 10, b // 10, b % 10}:
            s[m] += 1

  • $\begingroup$ I'm not sure if you need to spoiler the code, but this main-meta answer explains how. I confirmed that this will work if you try it on your code. $\endgroup$
    – bobble
    Nov 26, 2020 at 4:21
  • $\begingroup$ @bobble Thank you, it works. I also tried to remove the <code></code>, and it seems that there is no difference. $\endgroup$
    – WhatsUp
    Nov 26, 2020 at 4:25
  • $\begingroup$ There is a 'P' on the illustration. That means it is a 12h display (with am/pm). $\endgroup$
    – Florian F
    Nov 26, 2020 at 13:51
  • $\begingroup$ @FlorianF I noticed that too, but also the statement says "from 00:00 to 23:59", so it was a bit confusing and I just interpret the 'P' as something else. Also this doesn't change the answer a lot: simply replace $24$ with $12$ and multiply all the results by $2$. $\endgroup$
    – WhatsUp
    Nov 26, 2020 at 20:43
  • $\begingroup$ @Florian, I have updated the illustration. $\endgroup$
    – Nick
    Nov 27, 2020 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.