Library

DFA · Regular

A 24-hour clock time, HH:MM

Valid times from 00:00 to 23:59. The only subtle state is the first digit: after a 2 the next may only be 0–3, so 0/1 and 2 lead to different places.

starth01h2hhcolonm1done0, 120, 1, 2, 3, 4…0, 1, 2, 3:0, 1, 2, 3, 4…0, 1, 2, 3, 4…
The machine as drawn — 7 states, 34 transitions.

The author’s examples, run

00:00 → accept09:45 → accept19:59 → accept23:07 → accept24:00 → reject19:60 → reject9:45 → reject2359 → reject