Problem 392. Clock Hand Angle 1
Given a time in HH:MM:SS, find the smallest angle (in degrees) between the hour and minute hand
Solution Stats
Problem Comments
-
4 Comments
Show
1 older comment
Rafael S.T. Vieira
on 7 Jun 2020
I solved, but the solution is wrong, there is no 60th minute in analog clocks (test case 20). Do not try to use mod until they fix it.
Marco Riani
on 15 Apr 2023
This is just to confirm what Rafael S.T. Viera stated!
Brandon
on 3 May 2023
There is no reason to use mod at all when parsing the time. Treat 8:60 like 9:00.
Andrew
on 8 Apr 2025
Remove the '08:60:33' test case. Parsing timestamps is not the focus of this exercise, calculating the angle between the clock hands is.
Solution Comments
Show commentsProblem Recent Solvers298
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15656 Solvers
-
3384 Solvers
-
3517 Solvers
-
282 Solvers
-
Rounding off numbers to n decimals
4995 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!