Ad
  • Custom User Avatar

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

  • Custom User Avatar

    how does it work? Any documentation that support this assumtion... =)

  • Default User Avatar

    You are right, and sometimes the shortest code is also the best, depending on language ie Haskell, JS Java C# F#, if it is short because it is coded functionally, or with nice comprehensions in python. not always just depends

  • Custom User Avatar

    To be fair, the never-lasting debate about "what is best practice" happens because best practice can be many different things (same to clever):

    • Fastest code
    • Shortest code
    • Best algorithm
    • Cleanest code
    • Most informative code
    • Most thorough code
    • ...

    It's kinda like you're in Oscar and there's only a "Movie of the Year" category. Of course everyone will argue about its all-encompassing nature.

    The way to go is, of course, split it into those categories and rank by there. But then it (probably) becomes too complicated for everyone. So I guess we're stuck at now.

  • Default User Avatar

    There are many dirty tricks to make your code execution faster. Most of which you will never use in production code. People will start upvoting fastest answers as "Best Practice" and people who learn to code will pick up some bad habbits. The only thing that could work is a special category of katas, purposely curated for execution time optimizations with solutions showed from fastest to slowest.

  • Custom User Avatar

    > implying shortest code is never also the fastest code
    > implying fastest code = best code

    Okay, let's switch to micro-optimizations then?

  • Custom User Avatar

    Duration of execution is a criteria but this shouldn't be THE criteria to determine the best solution. The best solution should be a fine balance between complexity(related to execution time), readability and best practice.

  • Custom User Avatar

    "They said it before, and we'll say it again..."

    Add my vote also for a parallel "time to run" score! :D

    Possibly this could lead to excessive re-running of solutions to get a lucky fast score. So maybe limit the publicable time-to-rum score just to a user's first successful solution for a given kata, or something like that?

  • Custom User Avatar

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

  • Custom User Avatar

    The items in the array may also be null values. Your code uses if (x) but you need to have a null check inside the for loop to check if the current value is a null value.

  • Custom User Avatar

    Shit. My bad, didn't see the function name - only the description.

  • Default User Avatar

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

  • Default User Avatar

    what does -> do?
    where is row declared in valid9?
    can someone explain the code please?

    couldn't you avoid the "series whose unique numbers add up to 45 but are not valid sudoku wins. For example 2, 2, 9, 9, 6, 1, 8, 14, 5 or 0, 0, 0, 0, 0, 0, 0, 45. " by doing row.uniq.size == 9

  • Default User Avatar

    what does -> do?
    where is row declared in valid9?
    can someone explain the code please?

  • Default User Avatar

    how exatcly does the number get added to the cache?

  • Loading more items...