Crestron Electronics interview question

Given a string write a program to reverse it.

Interview Answers

Anonymous

20 Nov 2017

namespace ReserveString { class Program { static void Main(string[] args) { Console.WriteLine(Reserve("ABCDEFGHIGKLMNOPQRST")); Console.ReadLine(); } public static string Reserve(string str) { if (str == null || str.Length <= 0) { return ""; } return str[str.Length - 1] + Reserve(str.Substring(0, str.Length - 1)); } } }

Anonymous

13 Mar 2018

Thanks for this valuable information, are there other technical questions more difficult than this that were asked?