FunctionRacerProblemsRace

Angle Between Clock Hands

EasyMathPython, JavaScript, TypeScript, Java, C++

On an analog clock, return the smaller angle in degrees between the hour hand and the minute hand at hour:minutes. The hour hand moves continuously (at 3:30 it is halfway between the 3 and the 4). Return a float.

Example 1

hour 3
minutes 30
returns 75.0

The hour hand is at 105 degrees, the minute hand at 180: 75.0.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems