LintCode-剑指Offer-(8)旋转字符
来源:互联网 发布:广东玉米数据网账号 编辑:程序博客网 时间:2024/06/18 00:34
class Solution {public: /** * @param str: a string * @param offset: an integer * @return: nothing */ void rotateString(string &str,int offset){ //wirte your code here if (str.length()==0)return; offset = offset%str.length(); int i =(str.length()-offset)%str.length(); int j = i; string s; bool start = true; while (i!=j|start==true){ s.push_back(str[i]); i = (i+1)%str.length(); start = false; } str = s; }};
0 0
- LintCode-剑指Offer-(8)旋转字符
- LintCode-剑指Offer-(159)寻找旋转排序数组中的最小值
- LintCode-剑指Offer-(28)寻找旋转排序数组中的最小值
- LintCode 8 旋转字符串
- LintCode-剑指Offer-斐波拉契
- LintCode-剑指Offer-(160)寻找旋转排序数组中的最小值Ⅱ
- 剑指offer面试题8--数组旋转
- 剑指offer-旋转数组
- LintCode之8 旋转字符串
- LintCode-剑指Offer-空格替换
- LintCode-剑指Offer-(245)子树
- LintCode-剑指Offer-(3)统计数字
- 【剑指offer】左旋转字符串
- 剑指offer 2.4 旋转数组
- 剑指offer--左旋转字符串
- 《剑指offer》左旋转字符串
- 剑指offer—旋转字符串
- 剑指offer:左旋转字符串
- Java基础常见错误
- 读书笔记——node开发指南——博客系统express4源码
- 2015年12月04日 每天半小时学英语
- 使用第三方图片缩放库PhotoView遇到的问题
- 算法笔记——【递归】全排列问题
- LintCode-剑指Offer-(8)旋转字符
- 关于cocos2dx的背景音乐和音效(2)
- 激光共聚焦显微镜原理
- 最全Pycharm教程(9)——创建并运行一个基本的Python测试程序
- Model-View-ViewModel for iOS
- LintCode-剑指Offer-(1)A+B问题
- Python基本 char和string
- 截取时间戳转码方法
- CNN(卷积神经网络)在视频动作分类中的应用