This commit is contained in:
parent
dcc322307d
commit
14772aa21f
1 changed files with 8 additions and 0 deletions
8
medium/angle_between_hands_of_a_clock.py
Normal file
8
medium/angle_between_hands_of_a_clock.py
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
# https://leetcode.com/problems/angle-between-hands-of-a-clock
|
||||||
|
|
||||||
|
class Solution:
|
||||||
|
def angleClock(self, hour: int, minutes: int) -> float:
|
||||||
|
minute = 360 / 60 * minutes
|
||||||
|
hour = hour % 12
|
||||||
|
hour = 360 / 12 * hour + 360 / 12 / 60 * minutes
|
||||||
|
return min(abs(hour - minute), 360 - abs(hour - minute))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue