Commit f3127e80 by 安晓东

Update homework_01.py

parent 52e9e587
...@@ -18,3 +18,23 @@ def convert(s, numRows): ...@@ -18,3 +18,23 @@ def convert(s, numRows):
s = convert("PAYPALISHIRING", 4) s = convert("PAYPALISHIRING", 4)
print(s) print(s)
# def convert(s, numRows):
# if numRows == 1:
# return s
# l = [''] * numRows
# print(l)
# row,step = 0,1
# for c in s:
# if row == 0:
# step = 1
# if row == numRows - 1:
# step = -1
# l[row] += c
# row += step
# return ''.join(l)
# print(convert('LEETCODEISHIRING', 3) ) # 预期输出 'LCIRETOESIIGEDHN'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment