Created
December 30, 2019 01:49
-
-
Save luoheng23/fbf4998254a0806489f71909fef47026 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def readBinaryWatch(self, num: int) -> List[str]: | |
"""copy from 思君满月""" | |
ret = [] | |
for hour in range(12): | |
for minute in range(60): | |
if (bin(hour) + bin(minute)).count('1') == num: | |
ret.append('%d:%02d' % (hour, minute)) | |
return ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment