Ad
  • Custom User Avatar
  • Custom User Avatar

    Yeah I don't think a performance optimization should ever trump a higher level approach without a significant advantage being in play. Write code at the highest level of abstraction available to you unless a compelling reason exists to go lower level.

  • Default User Avatar

    I don't agree with you. The structure of the code made me vote as best practice because of readability and maintainability
    but should have been a for loop for even better performance. Same as you

  • Custom User Avatar

    I think it's interesting that solutions marked with the highest 'clever' score are also coming up with the highest 'best practice' score. Those should, in most cases, be inverted.

    Recursion is clever but difficult to reason and computationally more expensive. It's loved for its mathematical purity; it's the most clever.

    Iteration is both faster and easier to reason; making almost always a best practice.

  • Custom User Avatar

    Great work! I give this marks for cleverness, as we do so love recursive solutions in comp sci.

    That said, recursive solutions are rarely the easiest to reason about and, while repleat with mathematical brilliance, computationally the most expensive.

    For that reason, I cannot mark best practice on a recursive solution when the iterative solution is almost the same size and is easier to reason for others.

    Still, neato!

  • Custom User Avatar

    Further, the minimum PHP version for solutions should be set to 7.1 now. 5x is dead. 7.0 is dead. 7.1 is old. 7.2 is old-current. 7.3 is current.

    Read this. It's not that easy.

  • 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

  • Custom User Avatar

    The php tests are considerabily lacking, as the one test neither does what the author says, nor provides a single common case for the situation.

    Further, the minimum PHP version for solutions should be set to 7.1 now. 5x is dead. 7.0 is dead. 7.1 is old. 7.2 is old-current. 7.3 is current.

  • 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