CT906

The Largest Step Beneath Verdigris

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Jeweler inherited the loom house at the copper works of Verdigris along with its curious bookkeeping system for tickets. Time to make sense of it. Task: Read n integers and print the largest absolute difference between two consecutive elements. For n=1 print 0. Input format: First line: n. Second line: n space-separated integers. Output format: Print the maximum consecutive absolute difference. Constraints: 1 <= n <= 22; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 2 611826 685345
Output: 73519

Example 2:

Input: 17 193611 -36037 466961 -324002 -73696 -529129 60954 -162465 -333298 -910303 417612 -7056 -495626 -601041 914437 929398 -389675
Output: 1515478

Example 3:

Input: 13 -76709 962512 -187077 404225 184540 -524466 -540714 -499129 -971101 220400 848208 291560 -228461
Output: 1191501

Constraints:

1 <= n <= 22; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Loading...
Test Cases:No test cases
No test cases available.