博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
leetCode刷题(将字符串转成W形状的字符串再以Z形字符串输出)
阅读量:6979 次
发布时间:2019-06-27

本文共 695 字,大约阅读时间需要 2 分钟。

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)

P   A   H   NA P L S I I GY   I   R
And then read line by line: 
"PAHNAPLSIIGYIR"

 

Write the code that will take a string and make this conversion given a number of rows:

string convert(string text, int nRows);
convert("PAYPALISHIRING", 3) should return 
"PAHNAPLSIIGYIR".
/** * @param {string} s * @param {number} numRows * @return {string} */var convert = function(s, numRows) {    var y=0;    var storeArr=[];    if(numRows==1){        return s;    }    for(var i=0;i

  

转载于:https://www.cnblogs.com/windseek/p/8662962.html

你可能感兴趣的文章
Exceptions Interview Questions
查看>>
阿里注册中心nacos使用整合Dubbo-原创
查看>>
openNebulafrontEnd ComputeNode 配置记录
查看>>
字符集
查看>>
《少年派的奇幻漂流》观后感
查看>>
关于本分类(codeforces-好题系列)
查看>>
Python 安装selenium
查看>>
c#_DropdownList Panel Textbox 控件交互使用,有autopostback和没有的区别
查看>>
3、JPA一些常用的注解
查看>>
C++中#include的工作原理
查看>>
Extjs:添加查看全部按钮
查看>>
地图染色问题
查看>>
MSSQL数据库统计所有表的记录数
查看>>
手动创建Spring项目 Spring framework
查看>>
设计模式中的原则
查看>>
Python--数据存储:pickle模块的使用讲解
查看>>
VIM多窗口编辑
查看>>
java子类对象和成员变量的隐写&方法重写
查看>>
Java基础教程(15)--枚举类型
查看>>
super的用法(带了解)
查看>>