Given two integers hour and minutes representing a time on an analog clock, return the smaller angle in degrees between the hour hand and the minute hand.
The returned value may be a non integer.
Constraints:
Input: hour = 1-int, minutes = 0-int
Output: 30.00000-float
Explanation: At 1:00, the minute hand is at 0° and the hour hand is at 30° (1 × 30), so the smaller angle is 30°.
Input: hour = 6-int, minutes = 0-int
Output: 180.00000-float
Explanation: At 6:00, the minute hand is at 0° and the hour hand is at 180° (6 × 30), so the smaller angle is 180°.
Input: hour = 11-int, minutes = 59-int
Output: 5.50000-float
Explanation: The minute hand angle is 59 × 6 = 354° and the hour hand angle is 11 × 30 + 59 × 0.5 = 330 + 29.5 = 359.5°. The difference |359.5 − 354| = 5.5° is already the smaller angle.
Input: hour = 9-int, minutes = 45-int
Output: 22.50000-float
Explanation: The minute hand angle is 45 × 6 = 270° and the hour hand angle is 9 × 30 + 45 × 0.5 = 270 + 22.5 = 292.5°. The difference |292.5 − 270| = 22.5° is the smaller angle.
Now, let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the correct problem: