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.
it is not, it is the index of a peak. in this kata, you have to return an array of peaks and an array of their indices
I don't know what values take WA for x-axis there, but they are wrong. Try with this other one: https://www.wolframalpha.com/input?i=plot+%5B%280%2C3%29%2C+%281%2C+2%29%2C+%282%2C+3%29%2C+%283%2C+6%29%2C+%284%2C+4%29%2C+%285%2C+1%29%2C+%286%2C+2%29%2C+%287%2C+3%29%2C+%288%2C+2%29%2C+%289%2C+1%29%2C+%2810%2C+2%29%2C+%2811%2C+3%29%5D&lang=es
I guess OP confusion came from the wrong graphic representation.
You're looking for all the peaks (think: mountain peaks), not just the highest one. The image you showed displays them both pretty well.
I'm a little bit confused:
[Example: pickPeaks([3, 2, 3, 6, 4, 1, 2, 3, 2, 1, 2, 3]) should return {pos: [3, 7], peaks: [6, 3]} (or equivalent in other languages)]
How is 7 a peak?
https://www.wolframalpha.com/input?i=plot+%5B3%2C+2%2C+3%2C+6%2C+4%2C+1%2C+2%2C+3%2C+2%2C+1%2C+2%2C+3%5D
That plateau after the peak is not a plateau-peak, it's just a plateau.
At index 20 there is a plateau-peak.
for arr [1,2,5,4,3,2,3,6,4,1,2,3,3,4,5,3,2,1,2,3,5,5,4,3],
expected { pos: [ 2, 7, 14 ], peaks: [ 5, 6, 5 ] } to deeply equal { pos: [ 2, 7, 14, 20 ], peaks: [ 5, 6, 5, 5 ] }. How ?
expected { pos: [ 2, 3 ], peaks: [ 3, 2 ] } to deeply equal { pos: [ 2 ], peaks: [ 3 ] }
assert.deepEqual(pickPeaks([2,1,3,2,2,2,2,5,6]), {pos:[2], peaks:[3]});
why?
They're not.
{'pos': [3, 7], 'peak': [6, 3]} should equal {'pos': [3, 7], 'peaks': [6, 3]}
{'pos': [3, 7], 'peak': [6, 3]} should equal {'pos': [3, 7], 'peaks': [6, 3]}
{'pos': [3, 7, 10], 'peak': [6, 3, 2]} should equal {'pos': [3, 7, 10], 'peaks': [6, 3, 2]}
TF is this? These are completely SAME (pls help)
Finding thepeaks is not difficult, but your wanted solution with a Map and List is confusing, why not use a Map and put a position and a peakheight together?
https://www.codewars.com/kata/5279f6fe5ab7f447890006a7/discuss#64f5b8c72b610bbbb906767f
What is "peaks"??????????????????????
why for [3,2,3,6,4,1,2,3,2,1,2,2,2,1] the result is [3, 7, 10] why doenst [3, 7, 10, 12]
After a few hours, I still don't understand what I did, but it works
Loading more items...