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

Commit2f538ac

Browse files
committed
need define int first
1 parent8508517 commit2f538ac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎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