题目:将一个给定字符串s根据给定的行数numRows,以从上往下、从左到右进行 Z 字形排列。
示例:
输入:s = "PAYPALISHIRING", numRows = 4
输出:"PINALSIGYAHRPI"
解释:
以下代码将原字符串的每个字符按照Z字形规律放进二维数组,再将数组按行取出,得到变换后的字符串。
char * convert(char * s, int numRows){
int i, j = 0, k = 0;
const int row = numRows;
if(row==1||strlen(s)==1) return s;
const int col = strlen(s)/(row-1) +1;
char z[row][col+1];
for(i=0;i|


