Skip to content

Instantly share code, notes, and snippets.

@cshjin
Created January 28, 2015 21:18
Show Gist options
  • Save cshjin/b60b8a37991964534c81 to your computer and use it in GitHub Desktop.
Save cshjin/b60b8a37991964534c81 to your computer and use it in GitHub Desktop.
Creaking the Coding Interview
def solution(h, m):
""" Return the degree bewteen hour hand and minute hand
"""
min_deg = float(m) / 60 * 360
hour_deg = float(h) / 12 * 360 + float(m) / 60 * 360 / 12
return min(abs(min_deg - hour_deg), 360 - abs(min_deg - hour_deg))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment