Interview Question

Software Engineer I Interview Norcross, GA

Take an input string and output the reverse of that string

  . May use any programming language.
Answer

Interview Answer

3 Answers

0

#done in python

myString = "This is a test"
''.join(reversed(myString))

#note: there are two single quotes before .join()

Raul Gil on Sep 14, 2012
1

$string = 'Hello';
echo strrev($string);

Jessie on Dec 12, 2012
0

They won't let you use prebuilt functions like reversed() or strrev(), its not a test of being able to search documentation.

#python2.7
string = 'hello'
reversed_string = string[-1::-1]
print reversed_string

Candice on Jul 23, 2014

Add Answers or Comments

To comment on this, Sign In or Sign Up.