标题: [google面试题]Write a function to reverse the order of words in a string in place. [打印本页] 作者: 宋倩倩 时间: 2013-7-30 14:00 标题: [google面试题]Write a function to reverse the order of words in a string in place. 作者: 淡写轻描 时间: 2013-7-30 14:18
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.