[google面试题]Write a function to reverse the order of words in a string in place.
Answer:Reverse the string by swapping the first character with the last character,these condcharacter with the second‐to‐last character,and soon.Then,go through the string looking for spaces,so that you find where each of the words is.Reverse each of the words you encounter by again swapping the first character with the last character,these condcharacter with these cond‐to‐last character,and soon.
页:
[1]