Trains the technique from
LeetCode 1344Angle Between Hands of a ClockThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A brass tide dial in a harbour office has a round face split into 12 equal spans. The spans carry the numbers 1 to 12, going clockwise, and span 12 sits at the top of the face. Two needles turn clockwise above the face. The long needle sweeps the whole face once per hour. The short needle drifts continuously and takes twelve hours to come back around, so it usually rests partway between two spans rather than on one.
The dial is read as two whole numbers. hour_mark runs from 1 to 12 and names the span the short needle has most recently reached. minute_mark runs from 0 to 59 and counts how many marks past the top of the face the long needle has travelled, out of the 60 marks that make up one full sweep. When hour_mark is 12 and minute_mark is 0, both needles point straight up.
The two needles cut the face into two wedges. Return the size in degrees of the tighter wedge as a floating-point value. Return the exact size; do not round it or truncate it.
Example 1
The needles cut the face into wedges of 70 and 290 degrees, and the tighter of the two is what comes back.
Example 2
Here the two wedges are 87.5 and 272.5 degrees, so the reported size is not a whole number of degrees.
Example 3
Both needles point straight up, so there is no wedge between them at all.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def dial_needle_gap(hour_mark: int, minute_mark: int) -> float:public double dialNeedleGap(int hourMark, int minuteMark)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.