[LeetCode] Bitwise AND of Numbers Range
发布时间:2020-12-13 21:04:53 所属栏目:PHP教程 来源:网络整理
导读:Given a range [m,n] where 0 = m = n = 2147483647,return the bitwise AND of all numbers in this range,inclusive. For example,given the range [5,7],you should return 4. 解题思路 ① n(n⑴),可以去除n的最低位的1。 ② 从n1直与到m,可以去掉的1就
Given a range [m,n] where 0 <= m <= n <= 2147483647,return the bitwise AND of all numbers in this range,inclusive. For example,given the range [5,7],you should return 4. 解题思路① n&(n⑴),可以去除n的最低位的1。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |