```
class Solution {
public String convert(String s, int numRows) {
if(s.length() == 0 || s.length() == 1 || s.length() < numRows || numRows == 1)
return s;
String result = "";
int n = (numRows - 1) * 2;
for(int i = 0; i < numRows; i++) {
for(int j = 0; j < s.length(); j++) {
if(j % n == i || j % n == n - i)
result += s.charAt(j);
}
}
return result;
}
}
```