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.
I'm surprised it made that much of a difference. thanks again!
for this code:
Metrics
There is only one function in this file.
It takes one argument.
This function contains only one statement.
Cyclomatic complexity number for this function is 3.
https://jshint.com/
Metrics
There are 2 functions in this file.
Function with the largest signature take 2 arguments, while the median is 1.5.
Largest function has 1 statements in it, while the median is 0.5.
The most complex function has a cyclomatic complexity value of 2 while the median is 1.5.
////////////////////////////////////////
I took from https://jshint.com/
in my opinion complexity 2 is quite good;
Nice! I've updated your speed in the table.
without, uh, recreating the
new Set
thanks for the info!
Hey rowcased
When running the tests it will say "Completed in Nms" for the overall code and each group of the tests. The relevant bit for us is the time taken for the "this is where we run the user code" bit. I've done the tests and added you to the table.
okay, so I have no idea how fast this is
Speedy! I've added this to the comparison table.
You're welcome! It was a great idea for a kumite, so thank you for contributing the original idea.
that's awesome! Thanks RobsonMoon! It turned out, creating a new data structure is the fastests.
I've made a fork of the original solution, but with a range of tests for speed checking. I've included the speed of everyone's solutions in the comments of that fork.
This version has 50 tests, with 10 tests at 5, 50, 500, 5000 and 50000. I've used that to compare the speeds of the submitted solutions:
Sorting is not helping a single bit here. In the worst case scenario, you'd receive an array consisting only of positive/negative numbers (except one if a pair is guaranteed to exist) and still make
n^2
lookups. The only way to achieve what you want is to filter positive and negative values into 2 separate arrays and performm * (n - m)
lookups instead.Sorting is a very expensive though, because of the large amount of operations required to change the array.
Ideally we need a large amount of test cases, with a range of values. Then we could do a speed comparison.
Loading more items...