标签:
https://leetcode.com/problems/binary-watch/ // 参考 https://discuss.leetcode.com/topic/59374/simple-python-java // 非常棒的方法 public class Solution { public List<String> readBinaryWatch(int num) { List<String> lt = new ArrayList<String>(); for (int m=0; m<12; m++) { for (int n=0; n<60; n++) { if (Integer.bitCount(m*64+n) == num) { lt.add(String.format("%d:%02d", m, n)); } } } return lt; } }
标签:
原文地址:http://www.cnblogs.com/charlesblc/p/5891226.html