Skip to content

Commit abb6b27

Browse files
solves binary watch in python
1 parent cc6dc92 commit abb6b27

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
| 387 | [First Unique Character in String](https://leetcode.com/problems/first-unique-character-in-a-string) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/FirstUniqueCharacter.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/first_unique_character_in_string.py) |
107107
| 389 | [Find the Difference](https://leetcode.com/problems/find-the-difference) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/FindTheDifference.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/find_the_difference.py) |
108108
| 392 | [Is Subsequence](https://leetcode.com/problems/is-subsequence) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/IsSubsequence.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/is_subsequence.py) |
109-
| 401 | [Binary Watch](https://leetcode.com/problems/binary-watch) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/BinaryWatch.java) |
109+
| 401 | [Binary Watch](https://leetcode.com/problems/binary-watch) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/BinaryWatch.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/binary_watch.py) |
110110
| 404 | [Sum of Left Leaves](https://leetcode.com/problems/sum-of-left-leaves) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/SumOfLeftLeaves.java) |
111111
| 405 | [Convert a Number to Hexadecimal](https://leetcode.com/problems/convert-a-number-to-hexadecimal) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](https://github.com/anishLearnsToCode/leetcode-algorithms/blob/master/src/ConvertNumberToHexadecimal.java) |
112112
| 408 | [Valid Word Abbreviation](https://leetcode.com/problems/valid-word-abbreviation) | Easy | |

python/binary_watch.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Solution:
2+
def readBinaryWatch(self, num):
3+
return ['%d:%02d' % (h, m)
4+
for h in range(12) for m in range(60)
5+
if (bin(h) + bin(m)).count('1') == num]

0 commit comments

Comments
 (0)