Angle Calculation Between Clock Hands
Given a specific time in hours and minutes, your task is to calculate the smallest possible angle between the hour hand and the minute hand of a clock.
Example:
Input:
T = 2
H = 3, M = 30
H = 9, M = 45
Output:
75
112
Explanation:
In the first example, when the time is 3:30, the smaller angle between the hour and minute hands is 75 degrees.
Constraints:
1 ≤ T ≤ 50
1 ≤ H ≤ 12
0 ≤ M ≤ 59
- Time limit: 1 second
Note:
There are two potential angles between the clock hands, but you must return the minimum of these two angles. When computing the angle, return its floor value, e.g., for an angle of 15.2, you should return 15.
Ensure your implemented function outputs the results as expected.
Be the first one to answer
Add answer anonymously...
Top UBS ENO interview questions & answers
Top HR questions asked in UBS ENO
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app