Zigzag Conversion
Medium
Strings
String
Convert string to zigzag pattern with numRows rows, then read line by line.
Constraints
1 ≤ numRows ≤ 1000
Examples
Example 1:
Input: PAYPALISHIRING
3
Output: PAHNAPLSIIGYIR
Example 2:
Input: PAYPALISHIRING
4
Output: PINALSIGYAHRPI
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console