Convert string s into a zigzag pattern on numRows rows. Then read line by line. Return the converted string.
Input: s = "PAYPALISHIRING", numRows = 3
Output: "PAHNAPLSIIGYIR"
Input: s = "PAYPALISHIRING", numRows = 4
Output: "PINALSIGYAHRPI"
Input: s = "A", numRows = 1
Output: "A"
Runner uses stdin: first line is the input string, second line is the integer numRows (e.g.PAYPALISHIRING\n3). Program must print final string.
No submissions yet.
Talk about row-wise simulation, index math, time/space tradeoffs.