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.
Ah, thanks for pointing it out, I changed it on a fork
I would suggest 'if they want' as a a gender-neutral replacement for 'if he wants'
I am sorry, i just learn about JS. if you can add multiple languange it would be great.
Is this avalaible on Python? Try adding multiple languages.
Dont worry, i am still learning too. The Math.floor is for rouding down, for example the number is 1100.000000002, the number will be 1100.
Ok, i will add the rounding in description. Thanks for the input
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.
how could this solution improve the time complexity? is that because the if clause is stated before the return?
I can actually code better than this but I never seem to get ideas as I am still learning to code. That is 1 thing that I have to improve.
Nice thinking.
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.
Loading more items...