Skip to content

Commit ab7d36a

Browse files
authored
Create Solution.java
1 parent 52110ea commit ab7d36a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public List<String> readBinaryWatch(int num) {
3+
List<String> res = new ArrayList<>();
4+
for (int i = 0; i < 12; ++i) {
5+
for (int j = 0; j < 60; ++j) {
6+
if (Integer.bitCount(i) + Integer.bitCount(j) == num) {
7+
res.add(String.format("%d:%02d", i, j));
8+
}
9+
}
10+
}
11+
return res;
12+
}
13+
}

0 commit comments

Comments
 (0)