public class Solution { /** * @param s: the given string * @param numRows: the number of rows * @return: the string read line by line */ public String convert(String s, int numRows) { // Write your code here if (nRows <= 1) return s; string res = "…