- [Leetcode][String]字符串相关题目汇总/分析/总
- Leetcode151. Reverse Words in a
- Lintcode53 Reverse Words in a St
- LeetCode | Reverse Words in a St
- 151. Reverse Words in a String
- LeetCode #344. Reverse String
- Leetcode 186. Reverse Words in a
- 151. Reverse Words in a String
- Reverse Words in a String
- Leetcode 151. Reverse Words in a
question
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
solution
char* reverseString(char* s){
int size;
for(size=0;s[size]!='\0';size++);
int low=0,high=size-1;
char tmp;
while(low<high){
tmp=s[low];
s[low]=s[high];
s[high]=tmp;
low++;
high--;
}
return s;
}







网友评论