题解 | #左旋转字符串#
左旋转字符串
https://www.nowcoder.com/practice/12d959b108cb42b1ab72cef4d36af5ec
class Solution { public: string LeftRotateString(string str, int n) { if (str.empty()) return ""; // 特殊情况 return str.substr(n%str.size(), n%str.size() - str.size()) + str.substr(0, n%str.size()); } };