201. Bitwise AND of Numbers Rang
2016-12-30 本文已影响0人
我是你的果果呀
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.
[26, 30],它们的二进制如下:
左边公共部分决定了区间与的结果, 所以找到它再向左移回来。