Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
towers of hanoi
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { char startPeg = 'A'; char endPeg = 'C'; char tempPeg = 'B'; int totalDisks = 3; solveTowers(totalDisks, startPeg, endPeg, tempPeg); } private static void solveTowers(int n, char startPeg, char endPeg, char tempPeg) { if (n > 0) { solveTowers(n - 1, startPeg, tempPeg, endPeg); Console.WriteLine("Move disk from " + startPeg + ' ' + endPeg); solveTowers(n - 1, tempPeg, endPeg, startPeg); } } } }
run
|
edit
|
history
|
help
1
ICollection<T>.Add(T) - Performance Test
Quadratic equation
LCM and GCD
vera
Get a webpage - the async way
The abstract factory design pattern implemented in c# using generics.
Kumaran-RegText-CityStatePostalCode Parsing
Lat/Lon with buffer
ExtensionDateTime
Static 2