Flip All Bits
A number can be viewed as a row of 32 zeroes and ones. The function flipping_bits receives an integer n in the range from 0 to 2^32 - 1. Replace every bit with its opposite: 0 becomes 1, and 1 becomes 0. Return the decimal value of the resulting number.
Примеры
Ввод
2147483647Вывод
2147483648Ввод
1Вывод
4294967294Ввод
0Вывод
4294967295Нужно реализовать
def flipping_bits(n: int) -> int:
Теги
math
Idħol biex tara l-istorja tas-sottomissjonijiet
IdħolIdħol biex tuża l-Mentor tal-AI
IdħolVisible tests
1
Input
2147483647Expected
21474836482
Input
1Expected
42949672943
Input
0Expected
42949672954
Input
4294967295Expected
05
Input
100Expected
42949671956
Input
999999Expected
4293967296Focus radio
Paused · SomaFM · Fluid