Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
python-demo
提交
4f7f0b1f
P
python-demo
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
python-demo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
python-demo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
4f7f0b1f
编写于
6月 24, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:第二天
上级
13468770
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
61 addition
and
0 deletion
+61
-0
00-chartgpt/chainlit/nohup.out
00-chartgpt/chainlit/nohup.out
+4
-0
14_刷题/day02/problem_solving_16.py
14_刷题/day02/problem_solving_16.py
+32
-0
14_刷题/day02/problem_solving_17.py
14_刷题/day02/problem_solving_17.py
+25
-0
未找到文件。
00-chartgpt/chainlit/nohup.out
浏览文件 @
4f7f0b1f
...
...
@@ -140,3 +140,7 @@ openai.error.APIConnectionError: Error communicating with OpenAI: HTTPSConnectio
engine was transferred to model_kwargs.
Please confirm that engine is what you intended.
2023-06-23 14:38:43 - Your app is available at http://localhost:8000
2023-06-23 19:57:00 - WARNING! engine is not default parameter.
engine was transferred to model_kwargs.
Please confirm that engine is what you intended.
2023-06-23 19:57:00 - Your app is available at http://localhost:8000
14_刷题/day02/problem_solving_16.py
0 → 100644
浏览文件 @
4f7f0b1f
"""
丢失的数字
"""
from
typing
import
List
class
Solution
:
def
missingNumber
(
self
,
nums
:
List
[
int
])
->
int
:
nums
.
sort
()
if
nums
[
0
]
!=
0
:
return
0
for
i
in
range
(
1
,
len
(
nums
)):
if
nums
[
i
]
-
nums
[
i
-
1
]
>
1
:
return
nums
[
i
]
-
1
return
nums
[
-
1
]
+
1
def
missingNumber2
(
self
,
nums
:
List
[
int
])
->
int
:
"""
主技巧 数学相关,求0到n的和
:param nums:
:return:
"""
total
=
len
(
nums
)
*
(
len
(
nums
)
+
1
)
/
2
sum_num
=
sum
(
nums
)
return
int
(
total
-
sum_num
)
if
__name__
==
'__main__'
:
# root = Solution().missingNumber([3, 0, 1])
# root = Solution().missingNumber([0, 1])
root
=
Solution
().
missingNumber2
([
9
,
6
,
4
,
2
,
3
,
5
,
7
,
0
,
1
])
print
(
root
)
14_刷题/day02/problem_solving_17.py
0 → 100644
浏览文件 @
4f7f0b1f
"""
移动零
"""
from
typing
import
List
class
Solution
:
def
moveZeroes
(
self
,
nums
:
List
[
int
])
->
None
:
"""
Do not return anything, modify nums in-place instead.
"""
i
=
0
j
=
0
while
j
<
len
(
nums
):
if
nums
[
j
]
!=
0
:
nums
[
i
]
=
nums
[
j
]
i
+=
1
j
+=
1
for
index
in
range
(
i
,
len
(
nums
)):
nums
[
index
]
=
0
print
(
nums
)
if
__name__
==
'__main__'
:
Solution
().
moveZeroes
([
0
,
1
,
0
,
3
,
12
])
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录