Skip to content

Commit 040c6d2

Browse files
authored
Create Angle Between Hands of a Clock
1 parent 1f1ae4c commit 040c6d2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Angle Between Hands of a Clock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
public double angleClock(int hour, int minutes) {
3+
double min = ((double)minutes/60) * 360;
4+
double hr = (hour*30 + (min/360)*30)%360;
5+
// System.out.println(min);
6+
// System.out.println(hr);
7+
return Math.min(Math.abs(min - hr), 360 - Math.abs(hr - min));
8+
}
9+
}

0 commit comments

Comments
 (0)