Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
LeetCodeAnimation
Commits
2f538ac4
Commit
2f538ac4
authored
May 29, 2019
by
luzhzh
Browse files
need define int first
parent
85085171
Changes
1
Hide whitespace changes
Inline
Side-by-side
notes/LeetCode第268号问题:缺失数字.md
View file @
2f538ac4
...
...
@@ -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
];
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment