Skip to content

Instantly share code, notes, and snippets.

@nmattam
Created October 12, 2019 18:48
Show Gist options
  • Save nmattam/33a4980f59e0f3ee7bc487552153d9e7 to your computer and use it in GitHub Desktop.
Save nmattam/33a4980f59e0f3ee7bc487552153d9e7 to your computer and use it in GitHub Desktop.
class Solution(object):
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
rows, cols = (numRows, 14)
a = [[0]*cols]*rows
i = -2
j = 1
c = 0
while(c < len(s)):
i += 2
j -=1
print("Loop 1")
while (i < numRows and c < len(s)):
print("i is " +str(i))
print("j is " +str(j))
a[i][j] = s[c]
print(a[i][j])
i += 1
c += 1
i -= 2
j += 1
print("Between")
print("i is " +str(i))
print("j is " +str(j))
print("Loop 2")
while(i >= 0 and c < len(s)):
print("i is " +str(i))
print("j is " +str(j))
a[i][j] = s[c]
i -= 1
j += 1
c += 1
print(a[0][0])
print(a[1][0])
print(a[2][0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment