leetcode401 二进制手表问题
https://leetcode-cn.com/problems/binary-watch/
class Solution { public List<String> readBinaryWatch(int turnedOn) { List<String> result = new ArrayList<String>(); for(int counthour = 0; counthour < 12; counthour++) { for(int countminute = 0; countminute < 60; countminute++) { if(Integer.bitCount(counthour) + Integer.bitCount(countminute) == turnedOn){ result.add(counthour + ":" + (countminute>=10 ? "" : "0" ) + countminute); } } } return result; } }