Skip to content

Instantly share code, notes, and snippets.

@yungyungGwon
Created September 29, 2021 08:09
Show Gist options
  • Save yungyungGwon/c4455a3a223c2ca38fa32b50432e4b95 to your computer and use it in GitHub Desktop.
Save yungyungGwon/c4455a3a223c2ca38fa32b50432e4b95 to your computer and use it in GitHub Desktop.
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
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