leetcode 201. Bitwise AND of Numbers Range
来源:互联网 发布:js 获取input的value 编辑:程序博客网 时间:2024/06/14 07:07
class Solution(object): def rangeBitwiseAnd(self, m, n): """ :type m: int :type n: int :rtype: int """ """ if m == n, then m is the answer if m != n, then we look at the lsb it is obvious that there exist an even number and and and odd number in [m,n], which means the lsb of the results must be 0 since the lsb of (even & odd) is 0 """ offset = 0 while m != n: m >>= 1 n >>= 1 offset += 1 m <<= offset return m
阅读全文
0 0
- jquery flot画图
- STL容器之vector
- C++ 复习——关于字节
- vscode集成git bash
- javascript实现输入框不可编辑
- leetcode 201. Bitwise AND of Numbers Range
- 使用MIB来监控你的应用(tuxedo mib)
- 属性驱动封装
- Struts2+Spring+Hibernate+Jbpm技术实现Oa(Office Automation)办公系统第一天框架搭建
- dns2
- 【SpringMVC-004】idea创建SpringMVC项目傻瓜教程-REST简介
- hdu6012Lotus and Horticulture离散化线性取最大值
- Ubuntu 16.04+OpenFace的配置和简单人脸检测
- Java并发编程:线程池的使用