⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
document
All Projects
document
Overview
Activity
Issues
Spent time
Gantt
Calendar
News
Documents
Wiki
Files
Download (489 Bytes)
Files
» zhaochuzuichangdebuchongfudezifuchuang.py
UserName LastName
, 02/14/2025 10:33 AM
# 写一个算法,实现从一个字符串中找出最长的不重复的字符串
# 示例
# input_str = "asdddfaceddfdf"
# result = longest_unique_substring(input_str)
# print(result) # 输出:faced
def
longest_unique_substring
(
n
):
items
=
[]
items
.
append
(
n
)
length
=
len
(
items
)
max
=
len
(
items
[
0
])
for
i
in
range
(
1
,
length
):
if
max
<
len
(
items
[
i
]):
max
=
len
(
items
[
i
])
print
(
max
)
n
=
"asdddfaceddfdf"
longest_unique_substring
(
n
)
« Previous
1
…
167
168
169
170
171
…
437
Next »
(169-169/437)
Loading...