Interview Question

Senior Software Engineer Interview Mountain View, CA

Write a function that will reverse a string in the

  following fashion: Input: "My name is Amanda" Output: "Amanda is name My"
Answer

Interview Answer

3 Answers

0

You reverse the whole string in place and then you reverse the individual words.

Interview Candidate on Mar 17, 2011
0

" ".join(reversed(i.split()))

Python on Jun 27, 2012
0

Indeed some things that take quite a bit of work in C are incredibly easy to do in Python.

rumberobueno on Jun 27, 2012

Add Answers or Comments

To comment on this question, Sign In with Facebook or Sign Up