Motorola Mobility Interview Question: Reverse the words in a string... | Glassdoor

Interview Question

Software Engineering Intern Interview(Student Candidate) Sunnyvale, CA

Reverse the words in a string, but not the characters. Do

  it in linear time.
Answer

Interview Answer

2 Answers

0

Google it, not hard at all.

Interview Candidate on Feb 17, 2010
0

public String reverseWords(String in){
String[] tokens = in.split("");
if(tokens.length = 0; i--)
sb.append(tokens[i]);

return sb.toString();
}

ST on Mar 13, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.