Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
home_work
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
牛家玺
home_work
Commits
d31a52d2
Commit
d31a52d2
authored
Jan 11, 2019
by
牛家玺
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Z变换
parent
e2a30cf9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
6 deletions
+26
-6
hw1/Zconvert.py
+26
-6
No files found.
hw1/Zconvert.py
View file @
d31a52d2
def
convert
(
s
,
numRows
):
"""
:type s: str
:type numRows: int
:rtype: str
"""
\ No newline at end of file
# 初始化数组
rows
=
[
''
]
*
numRows
index
=
0
isInc
=
True
for
char
in
s
:
if
index
==
0
:
isInc
=
True
elif
index
+
1
==
numRows
:
isInc
=
False
offset
=
1
if
isInc
else
-
1
rows
[
index
]
=
rows
[
index
]
+
char
index
=
index
+
offset
str
=
''
for
row
in
rows
:
str
=
str
+
row
print
(
str
)
str
=
"0123456789"
str
=
"LEETCODEISHIRING"
convert
(
str
,
3
)
convert
(
str
,
4
)
Write
Preview
Markdown
is supported
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