less than 1 minute read

Given a clock time with hour and integer minutes, determine the smaller angle between the hour and the minute hands and floor it to the nearest integer.

Note that the hour hand moves too.

Bonus: When, during the course of a day, will the angle be zero?

Constraints

  • 0 ≤ hour ≤ 23
  • 0 ≤ minutes ≤ 59

https://binarysearch.com/problems/Clock-Angle

Examples

Example 1

Input

  • hour = 12
  • minutes = 22

Output

  • answer = 121

Solution

Leave a comment