6. ZigZag Conversion
class Solution { public String convert(String s, int numRows) { if(numRows==1) return s; int divisor=(numRows-1)*2; StringBuilder sb=new StringBuilder(); for(int i=0;i<numRows;i++) for(int j=0;j<s.length();j++) if(j%divisor==i||j%divisor==divisor-i) sb.append(s.charAt(j)); return sb.toString(); } }