• ###### kimambcommented on "Calculate BMI" kata

That's a part of the exercise.

• ###### crisanlucidcommented on "A String of Sorts" javascript solution

ordered - suppose to have unique values

• ###### crisanlucidcommented on "Negative and positive integer pair in the array" kumite

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/

• ###### crisanlucidcommented on "Negative and positive integer pair in the array" kumite

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;

• ###### RobsonMooncommented on "Negative and positive integer pair in the array" kumite

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.

• ###### FArekkusucommented on "Negative and positive integer pair in the array" kumite

in worst case scenariou you would go only through half of the numbers

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 perform `m * (n - m)` lookups instead.

• ###### RobsonMooncommented on "Negative and positive integer pair in the array" kumite

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.

• ###### remo1commented on "Negative and positive integer pair in the array" kumite

true, but, if you sort the numbers, in worst case scenariou you would go only through half of the numbers.
Without sorting in worst case you would have to go through all of them.

Please correct me if I'm wrong

• ###### FArekkusucommented on "Negative and positive integer pair in the array" kumite

There's no point in sorting if you're not using binary search.

• ###### remo1commented on "Negative and positive integer pair in the array" kumite

nothing really, the case imply that there is n negative and n positive numbers with just one pair.

thats why optimization is the key

• ###### crisanlucidcommented on "Negative and positive integer pair in the array" kumite

in case or more data like this
[3, 6, -8, -2, 4, 5, -1, 8, 1] => I have 2 pairs [-8,8] and [-1, 1]; what will be result in my example?
I am trying to see the big picture.

• ###### FArekkusucommented on "Negative and positive integer pair in the array" kumite

There is only one pair in the array.

From the original kumite description.

• ###### crisanlucidcommented on "Negative and positive integer pair in the array" kumite

hey Remo,
I think I get better understanting.
What will happen in case of
[3, 6, -8, -2, 4, 5, -1, 8, 1] what will be the return?

• ###### FArekkusucommented on "Negative and positive integer pair in the array" kumite

Replacing a loop with a higher order function is not improving it.

• ###### remo1commented on "Negative and positive integer pair in the array" kumite

Hey Crisan,

there should be only one pair in the array.

Also what if array has 1000+ ints in it?