Practice Zigzag Conversion
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Write the characters of s across numRows in a repeating zigzag: move down through the rows, then diagonally back up, and repeat until all characters have been placed. Read the rows from top to bottom, joining the characters in each row from left to right, and return that string. With one row, the result is s unchanged. For PAYPALISHIRING across three rows, the rows are PAHN, APLSIIG and YIR, producing PAHNAPLSIIGYIR.
Source: Zigzag Conversion on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "PAYPALISHIRING", numRows = 3
"PAHNAPLSIIGYIR"
# Example 2
s = "PAYPALISHIRING", numRows = 4
"PINALSIGYAHRPI"
# Example 3
s = "A", numRows = 1
"A"
Constraints
Related LeetCode Problems
Practice more problems similar to Zigzag Conversion.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.