Write the string in a zigzag pattern over numRows rows (down the first column, diagonally up to the top, repeat), then read it row by row.
For "PAYPALISHIRING" with 3 rows:
P A H N
A P L S I I G
Y I R
Reading row-by-row gives "PAHNAPLSIIGYIR".
Input
snumRowsOutput: the converted string.
PAYPALISHIRING 3
PAHNAPLSIIGYIR
PAYPALISHIRING 4
PINALSIGYAHRPI
AB 1
AB
Run your code against the sample tests, or Submit to run the full suite.