-
-
Save yungyungGwon/c4455a3a223c2ca38fa32b50432e4b95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution(n) : | |
bin = format(n, 'b') | |
cnt = bin.count('1') | |
n2 = n + 1 | |
cnt2 = 0 | |
while(cnt != cnt2): | |
bin2 = format(n2, 'b') | |
cnt2 = bin2.count('1') | |
n2+=1 | |
return n2-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution(n) : | |
cnt = bin(n).count("1") | |
n2 = n + 1 | |
cnt2 = 0 | |
while(cnt != cnt2): | |
cnt2 = bin(n2).count("1") | |
n2+=1 | |
return n2-1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment