class Solution(object):
def readBinaryWatch(self, turnedOn):
"""
:type turnedOn: int
:rtype: List[str]
"""
ans = []
for i in range(12):
for j in range(60):
if self.count_ones(i) + self.count_ones(j) == turnedOn:
if j < 10:
ans.append(str(i) + ":0" + str(j))
else:
ans.append(str(i) + ":" + str(j))
return ans
def count_ones(self, num):
ans = 0
while num > 0:
ans += num % 2
num = num // 2
return ans