16
Last seen 2 years ago
Member for 8 years, 24 days
Difficulty Normal
Hi, your solution looks almost like my one, but you can improve it by leaving "len(string)" out of your slicing in the "POP" case. It will work the same way ;)
More
Hi, nice code :)
A small improvement suggestion:
if "PUSH" in i:
queue += i[-1]
elif len(queue):
queue = queue[1:]
This will make your code shorter and more readable ;)
More
You can solve this in one line as well:
return bin(number)[2:].count('1')
:)
More