How do I print this results to the console in under 3 seconds? My previous question was too specific towards the static method error and not the optimization part....
I need to be able to print this combination of arrays in a specific manner under 3 seconds on the console.
using System;
namespace MelodiousPassword
{
private static int _n;
static void Main(string[] args)
{
_n = Convert.ToInt32(Console.ReadLine());
string[] c = { "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z" };
string[] v = { "a", "e", "i", "o", "u" };
Passwords("", c, v);
Passwords("", v, c);
}
static void Passwords(string w, string[] a, string[] b)
{
if (w.Length == _n)
Console.WriteLine(w);
else
foreach
(var l in a) { Passwords(w + l, b, a); }
}
}