Pergunta de entrevista da empresa Oracle

Given a string with space separated words, write and algorithm to reverse the order of the words.

Resposta da entrevista

Sigiloso

26 de jun. de 2016

using System; public class Test { public static void Main() { const string sample = "PLEASE REVERSE ME"; var strArray = sample.Split(' '); var result = String.Empty; for (int i = strArray.Length-1; i>=0; i--){ result += strArray[i] + " "; } Console.WriteLine(result); } }