public class Solution { public String convert(String s, int nRows) { if (s == null || s.isEmpty() || s.length() <= nRows || nRows == 1) { return s; } int length = s.length(); StringBuilder sb = new StringBuilder(); int step = 2 * (nRows - 1); int cou…