Back to course home
0% completed
Vote For New Content
Zigzag Conversion (medium)
Problem Statement
Given a string s
and a numRows
integer representing the number of rows, write the string in a zigzag
pattern on the given number of rows
and then read it line by line, and return the resultant string.
The zigzag pattern means writing characters in a diagonal down-and-up fashion. For example, given the string "HELLOPROGRAMMING" and 4 rows, the pattern would look like:
H R M
E P O M I
L O G A N
L R G
Reading it line by line gives us "HRMEPOMILOGANLRG".
Examples
Example 1:
- Input:
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page