题解 | #左旋转字符串#
左旋转字符串
http://www.nowcoder.com/practice/12d959b108cb42b1ab72cef4d36af5ec
class Solution {
public:
string LeftRotateString(string str, int n) {
if(str!=""){
n %= str.length();
string s1 = str.substr(n,str.length()-n+1);
s1.append(str.substr(0,n));
return s1;
}
return "";
}
};