Created
February 21, 2018 22:07
-
-
Save sourabh2k15/7d3620d84d3f37c3e92c0b23b26ded34 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 reverseString(string s) { | |
| int l = s.length(); | |
| for(int i = 0; i < l/2; i++){ | |
| char c = s[i]; | |
| s[i] = s[l-1-i]; | |
| s[l-1-i] = c; | |
| } | |
| return s; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment