I only feel justified in doing this because the previous best answer was a look-up table. :P
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
nmax = 10;
pmax = 52;
assert(isequal(peakOfPeaks(nmax),pmax))
|
2 | Pass |
%%
nmax = 30;
pmax = 9232;
assert(isequal(peakOfPeaks(nmax),pmax))
|
3 | Pass |
%%
nmax = 100;
pmax = 9232;
assert(isequal(peakOfPeaks(nmax),pmax))
|
4 | Pass |
%%
nmax = 1000;
pmax = 250504;
assert(isequal(peakOfPeaks(nmax),pmax))
|
5 | Pass |
%%
nmax = 2000;
pmax = 1276936;
assert(isequal(peakOfPeaks(nmax),pmax))
|
6 | Pass |
%%
nmax = 4500;
pmax = 6810136;
assert(isequal(peakOfPeaks(nmax),pmax))
|
7 | Pass |
%%
nmax = 8120;
pmax = 8153620;
assert(isequal(peakOfPeaks(nmax),pmax))
|
8 | Pass |
%%
nmax = 9998;
pmax = 27114424;
assert(isequal(peakOfPeaks(nmax),pmax))
|
Find all elements less than 0 or greater than 10 and replace them with NaN
13048 Solvers
What is the distance from point P(x,y) to the line Ax + By + C = 0?
277 Solvers
Given a window, how many subsets of a vector sum positive
743 Solvers
224 Solvers
Relative ratio of "1" in binary number
392 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!