bits():
My god. The pure clarity of your bits() code stunned me. My solution involved bit twiddling using band and an ugly hack to get the bit length of the number. I was shocked to see your solution. I just sat there for a few minutes staring at the beauty of the thing.
After getting over my shock, I couldn’t figure out how your solution worked, so I ran it through my tests to make sure it did work, and it passed with flying colors! Next, I ran through a couple of examples in my head, 8, 9, 10, and I’m still not sure how you came up with your solution! But staring at the simplicity of your code has been a balm on my bit frazzled mind.
Critique: What do I do after the bliss disappears, and I’m haunted by doubts that I’ll ever be able to write code like that? What about including some tests with your code? It makes it easier for a reviewer to test changes to your code. I think the problem description mentioned possibly including some tests.
I Forgot to mention this in my submission: Why not u