【文件属性】:
文件名称:leetcode2sumc-leetcode:leetcode
文件大小:125KB
文件格式:ZIP
更新时间:2021-07-06 17:48:32
系统开源
leetcode
2
sum
c
leetcode
leetcode刷题记录与总结。
autoauto-
auto-
auto-
auto
-
auto
-
auto-
auto
-
auto
-
auto
-
auto
-
auto-
auto
-
auto-
autoauto
比较难的题
tree:
124、894
状态压缩dp
常用概念
int
最大最小
0x7fffffff
0x80000000
将最低位设置为0
x&(x-1)
、
返回最低位包括:x^(x&(x-1))
后者
x^(-x)
算法
二分
注意这里使用前开后闭的写法
//
函数返回版本
int
start=0,end=size;
//
[start,end)
while
(start
<
end)
{
int
mid
=
start
+
(end
-
start)
/
2;
if
(array[mid]
>
k)
end
=
mid;
else
if
(array[mid]
<
k)
start
=
mid
+
1;
else
return
mid;
}
return
-1;
//
记录位置版本
int\npos=