Logic Builder # 1

Magnet December 26th, 2006

Given a string which consist of a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

i.e.
Input is:-
$message=“one two three four five”;

output should be:-
$message=“five four three two one”

With and without advance built in function.

Trackback URI | Comments RSS

Leave a Reply