Entries from 2019-05-08 to 1 day
Question Solution function solution(A) { let peaks = new Array(A.length).fill(false); let peakCount = 0; for (let i = 1; i < A.length-1; i++) { if (A[i-1] < A[i] && A[i] > A[i+1]) { peaks[i] = true; peakCount++; } } if (peakCount === 0 || …