AlgoDaily Solution
1Locked, only available for premium members.
Community Solutions
Community solutions are only available for premium users.
Access all course materials today
The rest of this tutorial's contents are only available for premium members. Please explore your options at the link below.
xxxxxxxxxx
22
var assert = require('assert');
function find_peak_element(arr) {
//fill this in
}
try {
assert.equal(find_peak_element([1, 2, 3, 1]), 2);
console.log('PASSED: ' + "assert.equal(find_peak_element([1,2,3,1]), 2)");
} catch (err) {
console.log(err);
}
try {
assert.equal([1, 5].includes(find_peak_element([1, 2, 1, 3, 5, 6, 4])), true);
console.log('PASSED: ' + "assert.equal([1, 5].includes(find_peak_element([1, 2, 1, 3, 5, 6, 4])), true)");
} catch (err) {
console.log(err);
}
OUTPUT
Results will appear here.