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
435bd732
Unverified
Commit
435bd732
authored
May 30, 2019
by
程序员吴师兄
Committed by
GitHub
May 30, 2019
Browse files
Merge pull request #26 from luzhzhsoft/master
fixed 201 problem -1 can not shift bug
parents
dc285aa7
2f538ac4
Changes
2
Hide whitespace changes
Inline
Side-by-side
notes/LeetCode第201号问题:数字范围按位与.md
View file @
435bd732
...
...
@@ -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
;
}
...
...
notes/LeetCode第268号问题:缺失数字.md
View file @
435bd732
...
...
@@ -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