leetcode 6. Z 字形变换

一、题目地址
https://leetcode-cn.com/problems/zigzag-conversion/
二、具体代码
/**
* @param {string} s
* @param {number} numRows
* @return {string}
*/
// 时间复杂度:O(n)
// 空间复杂度:O(n)
var convert = function(s, numRows) {
// 特殊情况判断
if(numRows < 2) { return s; } let rowsArr = Array.from(new Array(numRows), () => new String());
let i = 0;
let flag = -1;
for(let c of s) {
rowsArr

leetcode 6. Z 字形变换最先出现在Python成神之路

版权声明:
作者:siwei
链接:https://www.techfm.club/p/21607.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>