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.
Sorry for the late reply, your code is wrong, it's giving false positives on things that aren't plateaus. Print the input and you'll see it.
This comment is hidden because it contains spoiler information about the solution
Read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#print-input and don't mutate the input.
It happened to me too. Also, in my case, with java, every time I try to attempt the random tests fail, but if I put those on the testing section then the tests pass.
Has anyone run into an issue where the first test always works but every test after returns "NaN"? Its like its storing a value from the previous test run somewhere in my function.
My code works in other environments but I get this error in codewars
expected { pos: [2,3], peaks: [3,2] } to deeply equal { pos: [2], peaks [3] }
I don't even know what test this is. Any ideas?
Array(n)
creates an array of lengthn
,[...Array(n)]
creates an array filled withundefined
, of lengthn
.Can you explain how you brought an array into the function without 'let arr = []'?