Threadser.net
數據
關鍵字
功能建議
Following
Threads
Login
串文
串文鏈結
2024-11-20 21:27
You’re given a 32-bit integer i. Your task: reverse the bits of i. Example Input: 0…00101 Output: 10100…0 How would you do it?
讚
40
回覆
162
轉發
3
作者
Ramon Sorage
rsorage
粉絲
串文
91+
讚
回覆
轉發
24小時粉絲增長
無資料
互動率
(讚 + 回覆 + 轉發) / 粉絲數
Infinity%
回覆 (BETA)
最先回覆的內容
發文後
用戶
內容
3 小時內
早苗
w._.miu
i=-1-i
5 小時內
Hans Brende
hansbrende
By copy-pasting a bit-hack from the bit-hacks site, obviously.
6 小時內
Bagus Satri Hutomo
bagushutomo
Rotate my monitor 180
8 小時內
aprameya koushik sarukkai
aprameyacarfan
Number = input("Enter the 32 bit number: ")) Rev_bi = Number[::-1] print("the reverse number is",Rev_bi) Or if the person enters integer or natural number, then Num=int(input("Enter the number: ")) Binary=bin(Num)[2:] #the [2:] essentially ignores the 0b that's automatically generated Rev_bi=Binary[::-1] print("the Binary form of the number entered is",Binary) print("\nThe reversed Binary is:",Rev_bi)