标签:
public class Solution { public String convert(String s, int numRows) { String res = ""; if (s.length() < numRows || numRows == 1) { return s; } for (int i = 0; i < numRows; i++) { for (int j = i; j < s.length(); j += (2*numRows - 2)) { res += s.charAt(j); if (i != 0 && i != numRows - 1 && (j + 2*numRows - 2 - 2*i) < s.length()) { res += s.charAt(j + 2*numRows - 2 - 2*i); } } } return res; } }
标签:
原文地址:http://www.cnblogs.com/77rousongpai/p/4499246.html