Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
There is no mention of rounding anywhere in the description, why did you add it?
That's what Kumite are for ;)
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:
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.
This comment is hidden because it contains spoiler information about the solution
Why did you minify your code? ^^
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.
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)
Very poorly designed kata.
Please revise tests with edge cases (subdomain being different than "www" at the very least).
State your assumptions.
Look nice and compact, but it has unnecessary time complexity, when it could be linear.