Angle Between Hands of a Clock LeetCode solution in Java
1class Solution {2public double angleClock(int hour, int minutes) {3// Position of hour hand in a circle of 0 - 594double hrPos = 5 * (hour % 12);56// Adjust hour hand position according to minute hand7hrPos += (5 * minutes / 60.0);89double units = Math.abs(minutes - hrPos);1011// Take the min of distance between minute & hour hand and hour & minute hand12return Math.min(units, 60 - units) * 6;13}14}