Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit435bd73

Browse files
authored
Merge pull requestMisterBooo#26 from luzhzhsoft/master
fixed 201 problem -1 can not shift bug
2 parentsdc285aa +2f538ac commit435bd73

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

‎notes/LeetCode第201号问题:数字范围按位与.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
classSolution {
4949
public:
5050
int rangeBitwiseAnd(int m, int n) {
51-
int d = INT_MAX;
51+
unsignedint d = INT_MAX;
5252
while ((m & d) != (n & d)) {
5353
d <<= 1;
5454
}

‎notes/LeetCode第268号问题:缺失数字.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@
4040
classSolution {
4141
publicintmissingNumber(int[]nums) {
4242
int res=0;
43+
int i=0;
4344
//注意数组越界情况
44-
for (int i=0; i< nums.length;i++){
45+
for (; i< nums.length;i++){
4546
// i 表示完整数组中的数字,与原数组中的数字 nums[i] 进行异或,再与保存的结果异或
4647
res= res^i^nums[i];
4748
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp