Unverified Commit 435bd732 authored by 程序员吴师兄's avatar 程序员吴师兄 Committed by GitHub
Browse files

Merge pull request #26 from luzhzhsoft/master

fixed 201 problem  -1 can not shift bug
parents dc285aa7 2f538ac4
......@@ -48,7 +48,7 @@
class Solution {
public:
int rangeBitwiseAnd(int m, int n) {
int d = INT_MAX;
unsigned int d = INT_MAX;
while ((m & d) != (n & d)) {
d <<= 1;
}
......
......@@ -40,8 +40,9 @@
class Solution {
public int missingNumber(int[] nums) {
int res = 0;
int i = 0;
//注意数组越界情况
for (int i = 0; i < nums.length;i++){
for (; i < nums.length;i++){
// i 表示完整数组中的数字,与原数组中的数字 nums[i] 进行异或,再与保存的结果异或
res = res^i^nums[i];
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment