mirror of
https://github.com/Manoj-HV30/dsa-competitive-programming.git
synced 2026-05-16 19:35:22 +00:00
15 lines
448 B
C++
15 lines
448 B
C++
class Solution{
|
|
public :
|
|
vector<string> readBinaryWatch(int turnedOn){
|
|
vector<string> ans;
|
|
for(int h=0;h<12;++h){
|
|
for(int m = 0;m<60;++m){
|
|
if(__builtin_popcount(h)+ __builtin_popcount(m) == turnedOn){
|
|
ans.push_back(to_string(h)+":"+(m<10?"0":"")+to_string(m));
|
|
}
|
|
}
|
|
}
|
|
return ans;
|
|
}
|
|
}
|