You are given a string s and a positive integer numRows. Return the string after converting it to zig-zag pattern.
The string "GOOGLEISHIRING" is written in a zigzag pattern on a given number of rows numRows=3 like this: (you may want to display this pattern in a fixed font for better legibility)
G L H N
O G E S I I G
O I RAnd then read line by line: "GLHNOGESIIGOIR"
Example 1:
Input: s = "GOOGLEISHIRING", numRows = 4
Output: "GINOESIGOLHRGI"Explanation:
G I N
O E S I G
O L H R
G IExample 2:
Input: s = "GOOGLEISHIRING", numRows = 5
Output: "GHOSIOIRGEIGLN"Explanation:
G H
O S I
O I R
G E I G
L NConstraints:
1 <= s.length, numRows <= 1000s consists of English letters (lower-case and upper-case), ',' and '.'.