Largest Adjacent Difference (Set 3)

Easy

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

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

Example 1

maxAdjacentDifference()
Input
nums = [41, 33, 34, 45, 44, -34, 48, 30, 45, 33, 12, -21, -10, -7, 37, 25, 0]
Output
82

Why

`maxAdjacentDifference` returns `82` for this input.

Example 2

maxAdjacentDifference()
Input
nums = [22, -29, 33, 17, 13, -24, -19, -40, -16, -37, 24, 44, -32, 11]
Output
76

Why

`maxAdjacentDifference` returns `76` 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.