Created
July 19, 2022 07:41
-
-
Save icameling/3ec909f40f64b6da866b7032cd457a92 to your computer and use it in GitHub Desktop.
#字符串 #左旋转字符串
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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