Problem
Given an array of integers, find the maximal absolute difference between any two of its adjacent elements.
Example
For inputArray = [2, 4, 1, 0]
, the output should bearrayMaximalAdjacentDifference(inputArray) = 3
.
Input/Output
[input] array.integer inputArray
Guaranteed constraints:
3 ≤ inputArray.length ≤ 10
,-15 ≤ inputArray[i] ≤ 15
.[output] integer
The maximal absolute difference.
Solution
'Programming > Algorithm' 카테고리의 다른 글
[Algorithm] avoidObstacles (0) | 2018.03.02 |
---|---|
[Algorithm] isIPv4Address (0) | 2018.03.02 |
[Algorithm] areEquallyStrong (0) | 2018.03.02 |
[Algorithm] palindromeRearranging (0) | 2018.02.26 |
[Algorithm] arrayChange (0) | 2018.02.26 |