Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as00111001011110000010100101000000). 把一个无符号int数字,按二进制位反转过来 通过移位操作…
leetcode 上的题目 Determine whether an integer is a palindrome. Do this without extra space. 由于不能使用额外空间,所以不能把数字转化为字符串后进行比较.因为这样空间复杂度将为线性. leetcode给出了几点提示 1.判断负数是否为回文数,查了下回文数定义,负数不为回文数 2.就是注意不能把数字转字符串,因为不能用额外空间. 3.如果打算反转数字,需要处理好数字溢出情况 我的解决办法: 先获取数字长度,然后获取…