Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minute hand.
How to calculate the two angles with respect to 12:00? The minute hand moves 360 degrees in 60 minutes (or 6 degrees in one minute) and the hour hand moves 360 degrees in 12 hours(or 0.5 degrees in 1 minute). In h hours and m minutes, the minute hand would move (h * 60 + m) * 6, and the hour hand would move (h * 60 + m) * 0.5.
Constraints:
1 <= hour <= 120 <= minutes <= 59
Answers within 10^-5 of the actual value will be accepted as correct.
Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minute hand.
How to calculate the two angles with respect to 12:00? The minute hand moves 360 degrees in 60 minutes (or 6 degrees in one minute) and the hour hand moves 360 degrees in 12 hours(or 0.5 degrees in 1 minute). In h hours and m minutes, the minute hand would move
(h * 60 + m) * 6
, and the hour hand would move(h * 60 + m) * 0.5
.Constraints:
1 <= hour <= 12
0 <= minutes <= 59
Answers within10^-5
of the actual value will be accepted as correct.