Skip to content

Instantly share code, notes, and snippets.

@sourabh2k15
Created February 21, 2018 22:07
Show Gist options
  • Select an option

  • Save sourabh2k15/7d3620d84d3f37c3e92c0b23b26ded34 to your computer and use it in GitHub Desktop.

Select an option

Save sourabh2k15/7d3620d84d3f37c3e92c0b23b26ded34 to your computer and use it in GitHub Desktop.
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