Largest Adjacent Difference (Set 6)

Easy

Given an array of at least two integers nums, return the largest absolute difference between two neighbouring values.

Largest Adjacent Difference (Set 6) — the data. This set runs 4 cases: nums holds arrays of 31–38 items, with values from -39 to 50. The hidden cases are the largest of the set.

Example 1

maxAdjacentDifference()
Input
nums = [-19, 39, -14, 46, -27, -14, -15, -4, 36, 1, -27, 34, 37, 23, 48, 13, 14, -29, 41, -11, 20, 36, -28, 32, -34, 20, 0, -9, -14, 11, 17]
Output
73

Why

`maxAdjacentDifference` returns `73` for this input.

Example 2

maxAdjacentDifference()
Input
nums = [-14, 38, 28, 34, -13, 48, -23, -22, -1, 15, 15, -3, 39, -25, -16, 44, 3, 25, -24, -27, -32, -15, -38, -21, 3, -7, -8, 41, 7, 48, 7, 31, -3, -28, 21, -26, 31]
Output
71

Why

`maxAdjacentDifference` returns `71` for this input.
Constraints
2 <= nums.length <= 10^5
-10^4 <= nums[i] <= 10^4
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

Arrays

Implement maxAdjacentDifference in the editor and return the answer — printing it is never graded.