Python
# # 反转字符串 # @param str string字符串 # @return string字符串 # class Solution: def solve(self , str ): # write code here return str[::-1]
C
/** * 反转字符串 * @param str string字符串 * @return string字符串 */ char* solve(char* str ) { // write code here int j=strlen(str)-1; int i=0; char temp; while(i<j) { temp=str[i]; str[i]=str[j]; str[j]=temp; i++; j--; } return str; }