Skip to content

Instantly share code, notes, and snippets.

@icameling
Created July 19, 2022 07:41
Show Gist options
  • Save icameling/3ec909f40f64b6da866b7032cd457a92 to your computer and use it in GitHub Desktop.
Save icameling/3ec909f40f64b6da866b7032cd457a92 to your computer and use it in GitHub Desktop.
#字符串 #左旋转字符串
class Solution {
public:
string reverseLeftWords(string s, int n) {
reverse(s.begin(), s.end());
reverse(s.begin(), s.begin() + s.size() - n);
reverse(s.begin() + s.size() - n, s.end());
return s;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment