Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. public class Solution {
  2. public List<String> readBinaryWatch(int num) {
  3. List<String> times = new ArrayList<String>();
  4. for(int h=0; h<12; h++) {
  5. for(int m=0; m<60; m++) {
  6. if(Integer.bitCount(h) + Integer.bitCount(m) == num) {
  7. times.add(String.format("%d:%02d", h, m));
  8. }
  9. }
  10. }
  11. return times;
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement