Please write a function whose function is to reverse the input string.
Example:
Input: s = "hello"
Return: "olleh"
See: https://leetcode.com/problems/reverse-string/description/
C++:
class Solution { public: string reverseString(string s) { int n=s.size(); if(n==0||s.empty()) { return ""; } int left=0,right=n-1; while(left<right) { char tmp=s[left]; s[left]=s[right]; s[right]=tmp; ++left; --right; } return s; } };