2075. Decode the Slanted Ciphertext (Medium) - TengnanYao/daily_leetcode GitHub Wiki
class Solution:
def decodeCiphertext(self, encodedText: str, rows: int) -> str:
result = ""
cols = len(encodedText) // rows
for i in range(cols):
for j in range(rows):
k = i + j * cols + j
if k < len(encodedText):
result += encodedText[k]
return result.rstrip()