Ad
  • Custom User Avatar

    There is no mention of rounding anywhere in the description, why did you add it?

  • Custom User Avatar

    That's what Kumite are for ;)

  • Custom User Avatar

    While this is slightly faster, this if statement has no impact on time complexity. Time complexity is a mathematical concept that describe the overall scalability of the algorithm over its inputs. It does not quantify how long an "if" would take, but rather how many ifs you would run.

    That said, you have 2 inputs: an array of values, and a window size. Your solution is influenced by the input size in the following way:

    • you have a main loop over each entry in the values array (minus the last n items)
    • each iteration of the main loop, iterates over n elements to sum them.

    These 2 nested loops result in a time complexity of: O(len(values) * n)

    If you double the size of the values, and double the size of the window. Your execution time will be 4 times higher.

  • Custom User Avatar

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

  • Custom User Avatar

    Why did you minify your code? ^^

  • Custom User Avatar

    From a theoretical standpoint, looping once for the minimum and once for the maximum is equivalent to looping once and checking for maximum and minimum at the same time (time complexity).

    While this version looks nicer, you're performing a comparison of 2 values, 2 times, for each entry in the array. Additionally, you're always rewriting the value in the local variables.

    Perhaps it's better to simplify to 2 ifs, and only write when relevant.

  • Custom User Avatar

    First thing, the logic seems a bit fuzzy, I think you could allow people to enter a guess until a valid one is provided. Currently the guess uses up one additional guess (incorrectly). Another idea for improvement is, you can split the logic of the game from the logic of the single round, and you could parameterize the values (e.g. guess interval and number of guesses)

  • Custom User Avatar

    Very poorly designed kata.
    Please revise tests with edge cases (subdomain being different than "www" at the very least).
    State your assumptions.

  • Custom User Avatar

    Look nice and compact, but it has unnecessary time complexity, when it could be linear.