Lols 😆 Same here as well 🤣
I see. Without that, the bit manipulation would have won
Try with larger input.. just trying out
That's right Over 100 ms.. c'mon
Well.. what can I say 🤷 👍
Nope, I didn't benchmark... I'm just saying based on the nature of their operations. Though they are almost the same , the bit manipulation tends to perform better under a higher magnitude of data input
def reversed(x: int) -> int: num = 0 for _ in range (512): num = (num << 1) | (x & 1) x >>= 1 return num though, it is longer but is faster than having to convert num to binary string and then reverse it becs it directly manipulates the individual bits. I may be wrong
There's absolutely a faster way of doing this using bit manipulation. I'll write a simple function to prove it, although I'm busy now but will definitely show u why I said bit manipulation is faster
I don't agree with you sir. Python built in l support for bit manipulation is way much faster than the string manipulation Especially working with large amount of data