Your Submissions
You haven't submitted any code for this challenge yet. Solve the problem by passing all the test cases, and your submissions will appear here.
xxxxxxxxxx
36
var assert = require('assert');
function maximumDistance(arr, n) {
// Your code here
}
try {
let myArr = [10, 20, 30, 40];
n = myArr.length;
assertIsFunction(maximumDistance);
assert.equal(maximumDistance(myArr, n), 33);
console.log(
'PASSED: ' + '`maximumDistance([ 10, 20, 30, 40 ], 4)` should return `33`.'
);
} catch (err) {
console.log(err);
}
try {
let myArr = [-70, -64, -6, -56, 64, 61, -57, 16, 48, -98];
n = myArr.length;
assertIsFunction(maximumDistance);
assert.equal(maximumDistance(myArr, n), 167);
console.log(
'PASSED: `maximumDistance([ -70, -64, -6, -56, 64, 61, -57, 16, 48, -98 ], 10)` should return `167`.'
OUTPUT
Results will appear here.