【文件属性】:
文件名称:leetcode答案-LeetCode-Solutions:我自己的leetcode解决方案
文件大小:31KB
文件格式:ZIP
更新时间:2021-06-30 00:59:30
系统开源
leetcode
答案
LeetCode-Solutions
My
own
solutions
of
leetcode
题目总结
1047
每次遍历找到重复字母,删除后循环,O(n^2)
用栈来遍历字符串,入栈元素与栈顶比较,相同出栈一个字母否则入栈一个字母,最终的栈即为答案,O^(n)
92
反转链表(表内任意区间):
遍历一次,O(n)
三个指针,注意边界处理(首尾的NULL结点)
返回时head可能改变
通用总结
(py)
在已知区间长度时用
for
比
while
快,快在循环入口的判断部分
length
=
8
#1
cnt
=
0
while
cnt
<
8:
cnt
=
cnt
+
1
...
#2
for
_
in
range(length):
...
#2
is
faster
than
#1
【文件预览】:
LeetCode-Solutions-master
----23.py(2KB)
----README.md(700B)
----404.py(1KB)
----13.py(1KB)
----92.py(900B)
----figs()
--------1047.png(25KB)
----445.py(1KB)
----22.py(693B)
----72.py(2KB)
----1047.py(946B)
----887.py(2KB)
----542.py(759B)
----41.py(1KB)
----151.py(225B)