题目 解题思路 首先用比较取巧的办法: 执行结果为: 但这道题考察的显然是位运算,这里解释一下官方题解中给出的解法: (作者:LeetCode 链接:https://leetcode-cn.com/problems/reverse-bits/solution/dian-dao-er-jin-zhi-wei-by-leetcode/ 来源:力扣(LeetCode)) 可以看下每行代码干了什么,可能更好理解: 有种拿充电宝给手机充电的感觉,此消彼长。