score:1

Accepted answer
static void main(string[] args)
{
    string fromstr = "aaa";
    string tostr = "cde";
    list<string> outputlist = new list<string>();

    buildsequence(fromstr, tostr, outputlist);

    outputlist.foreach(s => { console.writeline(s); });
    console.readline();
}

private static void buildsequence(
    string fromstr,
    string tostr,
    list<string> outputlist,
    int index = 0,
    string prev = "")
{
    ienumerable<string> newstrlist = enumerable
        .range(fromstr[index], tostr[index] - fromstr[index] + 1)
        .select(c => string.concat(prev, (char)c));

    index += 1;

    if (index < fromstr.length)
    {
        foreach (string newstr in newstrlist)
        {
            buildsequence(fromstr, tostr, outputlist, index, newstr);
        }
    }
    else
    {
        outputlist.addrange(newstrlist);
    }
}

score:1

static int convertfrombase26(string value)
{
    const int a = (int)'a';
    int result = 0;
    foreach (var c in value.toupper())
    {
        result = (result * 26) + (c - a);
    }
    return result;
}

Related Query

More Query from same tag