You are given a non-negative integer n.
Your task is to invert the binary representation of n (changing all 0s to 1s and all 1s to 0s) and return the decimal value of the inverted binary number.
Note that:
n, ignoring any implicit leading zeros.Return the decimal value of the inverted binary number.
5
2
The number 5 in binary is 101. Inverting its bits gives 010, which is 2 in decimal.
0
1
The number 0 in binary is 0. Inverting its bit gives 1, which is 1 in decimal.
7
0
The number 7 in binary is 111. Inverting its bits gives 000, which is 0 in decimal.