loading...

re: Solving a Job Application Code Challenge VIEW POST

FULL DISCUSSION
 

Great Post! Thanks!

My C# approach would be something like this:

static void Main(string[] args) {
    var sortedString = longString
        .OrderBy(x => x.Equals('_') ? 2 : 1 )
        .ThenBy(x => x)
        .ToArray(); 
    Console.WriteLine(sortedString); 
}
 

The problem with fast shooting, is always the same, mistakes! :/

static void Main(string[] args) {
    var keyString = new string(longString
        .OrderByDescending(x => longString.Count(c => c.Equals(x)))
        .Distinct()               
        .ToArray());             
    Console.WriteLine(keyString.Split('_')[0]); 
}
Code of Conduct Report abuse