Udemy: Master Coding Interview - Arrays - #68

Run Settings
LanguageC#
Language Version
Run Command
using System; // Create a function that reverses a string: // 'Hi My name is Andrei' should be: // 'ierdnA si eman yM iH' class MainClass { static void Main() { string name = "Hi My name is Andrei"; Console.WriteLine("name = " + name); Console.WriteLine("name reversed = " + reverse(name)); } static string reverse(string s) { char[] c = s.ToCharArray(); char[] cReversed = new char[c.Length]; for (int i = 0; i < c.Length; i++) { cReversed[c.Length - i - 1] = c[i]; } return new string(cReversed); } }
Editor Settings
Theme
Key bindings
Full width
Lines