• Custom User Avatar

    imagine if it asks for nano seconds or an unit even smaller, the top solution is better cause it won't be much of a problem to edit compared to this one

  • Custom User Avatar

    There are people who can't do math, so...

  • Custom User Avatar

    Why isn't this solution best practice? It seems so simple and straight forward.

  • Custom User Avatar

    Not an issue~~

  • Custom User Avatar

    That was done.

  • Custom User Avatar

    Seems like fixed

  • Custom User Avatar

    I refuse to believe modifying prototypes is the way to go.
    I think it would be much better to simply write a sorting function.

  • Custom User Avatar

    If grammar is important to you, below are some suggested changes to "Your task is to calculate how much blank pages do you need."

    "Calculate how many blank pages you need."
    "Calculate how much paper you need."
    "Your task is to calculate how many blank pages you will need."

    If you care about grammar way too much, like me, here are the reasons for the suggestion:
    Proper usage is "many" where things can be counted ("How many pieces of cake are you gonna eat? Many pieces") and "much" when they are not countable("How much cake are you gonna eat? Soooo much cake.").

    The phrase "do you need" is not a big deal, but most native speakers would only use it in a question, "do you need x pieces of paper?" or "how much paper do you need?" and would use something like "you will need" or simply "you need" in this case.

  • Custom User Avatar

    I agree that for production code it is better to put curly braces around for blocks. Any linter would point that out.

    But on CodeWars people seem to favor more concise solutions, that's why you will see lots of one-liner.

    For this one, I think it is still readable as is, not being overly complex: no comma operator, one instruction per for block, only four lines.

    Of course it is not the best but I find it acceptable.

    Also, note that "best practice" does not represent only readability. People can vote because of many things independant of code style: algorithm, elegant way of solving the issue, performance, ...

  • Custom User Avatar

    Is it necessary to skimp on whitespace and leave out curly braces?
    They are free, easy, and make the code more readable to more people!

    Readability is a hugely important factor for "best practice."
    I had to spend some real time trying to make sense of this, admitedly, CLEVER solution.

    Someone who thinks this is really best practice care to explain your reasoning?

    PS. this is honest, I'm not trying to make trouble!

  • Custom User Avatar

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

  • Custom User Avatar

    Um... I don't think this should work.

  • Custom User Avatar

    Profoundly simple kata with only 2 tests.
    Perhaps add an input validation portion so there's something to solve here

  • Custom User Avatar

    Suggestions:
    Make the function inputs more expressive
    Specific the output should be to two decimal places

  • Custom User Avatar

    Nice kata! Clear assignment, no tricks, thorough tests

  • Loading more items...