Ad
  • Custom User Avatar

    After submitting my katas, I usually compare my code to others' solutions. Looking for improvements to my own solution, maybe learn something new, or to gloat about how my simple loops and logic run circles around all the garbage Linq code I see here. Horrendous!

    I came across your solution and was startled to see it is nearly identical to mine. I was super-surprised to see you using the ASCII offset method like me. One thing I do is test performance of my code compared to others' code. I have a timing system set up so I can copy someone's kata to my system and have the test started in about 10 seconds from seeing their code.

    So I naturally compared mine to yours and yours was ~9-10% faster. I didn't understand why, so I started looking at both with a magnifying glass.

    Three differences: your const is declared global to the class while mine is local to WordScore, your WordScore is a class method / mine is a local function, and your Split() is parameterless while mine is Split(" ").

    The first two differences made no difference...it was the Split that split the difference in our codes' executions times.

    Learn something new everyday!

  • Custom User Avatar

    The entire string shouldn't necessarily be lowered either; chars could be lowered as you go. It's pointless lowering the whole of aABCDEFGHIJKLMNOPQRSTUVWXYZ if you're going to detect a non-isogram on str[1]

  • Custom User Avatar

    The only limit is your PC memory

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution