Asked inUBS,ENO

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...
UBS ENO Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter