Python type conversion

  • 0

    I have a question regarding python type conversion. it seems like when I use result = result<<1+ (n>>1)&1 can't return correct result, however, if I use result = int(result<<1) + int((n>>i)&1) I will get correct answer. But I don't know the reason. Can someone explain?

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.