ZigZag Conversion(python)
2016-07-05 14:51
281 查看
The string
And then read line by line:
Write the code that will take a string and make this conversion given a number of rows:
解题思路:字符串处理,没什么知识点,需要一点编程技巧。
"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 N A P L S I I G Y 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".
解题思路:字符串处理,没什么知识点,需要一点编程技巧。
相关文章推荐
- python之禅
- python 利用文件锁单例执行脚本
- ZeroMQ - 三种模型的python实现
- 通过编写Python小程序来统计测试脚本的关键字分析 20160328
- Python 语言及其应用 Chapter_6_Note 1 类的super功能
- python之socket编程(一)
- Is there a difference between `==` and `is` in Python?
- Mac OSX python多版本管理工具:pyenv 和 virtualenv搭建
- Roman to Integer(python)
- Python Paramiko模块安装和使用
- github上总结的python资源列表
- python字符串的截取和替换
- 【Regex】初试Python下的中文正则表达式
- python 2.7 中文教程-4:编程基础
- python基础之删除文件及删除目录的方法
- Python类和实例
- 200行python代码实现一个类似django的简单模板引擎
- 在Python 中获得当前路径
- python 操作mysql数据库
- 四、Python数据类型