Skip to content

Instantly share code, notes, and snippets.

@AlexArchive
Created July 5, 2013 09:10
Show Gist options
  • Save AlexArchive/5933161 to your computer and use it in GitHub Desktop.
Save AlexArchive/5933161 to your computer and use it in GitHub Desktop.
Project Euler: Problem 22
private static IEnumerable<string> LoadNames()
{
string names =File.ReadAllText("names.txt");
return names.Split(',')
.Select(name => name.Substring(1, name.Length - 2));
}
private static int CalculateTotalScore()
{
return LoadName().OrderBy(x => x)
.Select((name, index) => (++index) * name.Sub(c => (int) c - 64))
.Sum();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment