Strings

Zigzag Conversion

medium
The string `"PAYPALISHIRING"` is written in a zigzag pattern on a given number of rows like this: ``` P A H N A P L S I I G Y I R ``` And then read line by line: `"PAHNAPLSIIGYIR"`. Write `convert(s, numRows)` that performs this conversion. Example: `convert("PAYPALISHIRING", 3)` → `"PAHNAPLSIIGYIR"`.
Hint steps(0/3 revealed)
  1. 1

    Complete previous step or reveal to unlock this hint.

  2. 2

    Complete previous step or reveal to unlock this hint.

  3. 3

    Complete previous step or reveal to unlock this hint.