C++/一行代码解决:
class Solution { public: string LeftRotateString(string str, int n) { return (n > str.size()) ? str : (str + str).substr(n, str.size()); } };
C++/一行代码解决:
class Solution { public: string LeftRotateString(string str, int n) { return (n > str.size()) ? str : (str + str).substr(n, str.size()); } };