Day 14 is finding the highest adjacent difference.
If a given array [2,4,1,0]
will has the highest adjacent difference is 3
.
If a given array [2,9,1,0]
will has the highest adjacent difference is 8
This is JavaScript solution
function arrayMaximalAdjacentDifference(nums) {
return Math.max(...nums.map((a,b) => Math.abs(a-b)));
}
Top comments (0)