BlackRock Interview Question: Inverse a sentence.... | Glassdoor

Interview Question

Software Engineer Interview(Student Candidate)

Inverse a sentence.

Answer

Interview Answer

3 Answers

0

Just go through the sentence...

Interview Candidate on Jan 30, 2013
0

Tokenize the string... put each token in a stack... pop the stack and print it.

Bhavya Shah on Aug 6, 2014
1

Reverse complete sentence as string reverse. Then reverse every word in it (using two variable i and j for index to hold one word, we can find word when we encounter space). Runtime O(n) + O(n) where n is length of string. no extra space required, everything is happening in-place

VN on Jan 27, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.