truncateThreshold should be set to 0 just in case, and assert.isTrue(Array.isArray(actual) && actual.length == 0, "Empty array [] expected") is a really weird way to do assert.deepEqual(actual, []).
Random tests added JS. I'm not sure the reference solution is correct. I've tested a couple of solutions, they all fail on some edge cases.
In fact, all solutions except 2 fail after adding random tests :s
description updated
fixed
Approved
Great kata, but my previous one was https://www.codewars.com/kata/5ac616ccbc72620a6a000096 (5kyu)
And they are really incompareable in terms of complexity...
I think this kata should be 6 kyu maximum
Could you add random tests? You could have a look at JS for a reference.
Author's solution was wrong. Updated JS with fixed solution.
fixed
Yes, the current
oS
function is wrong. Take the comparator on the last line from here and use it instead.All solutions are failing now, I think author's solution is wrong.
truncateThreshold
should be set to0
just in case, andassert.isTrue(Array.isArray(actual) && actual.length == 0, "Empty array [] expected")
is a really weird way to doassert.deepEqual(actual, [])
.Random tests added JS. I'm not sure the reference solution is correct. I've tested a couple of solutions, they all fail on some edge cases.
In fact, all solutions except 2 fail after adding random tests :s
JS adapted.
C# Translation, as with other translations, no input validation required.
Loading more items...