CT25574

Ysolde's coins Largest Step

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The council of the spice bazaar of Saffronia pays by the answer, and Ysolde intends to earn it. First: the full register of coins. 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 <= 257; -1000000 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 16 383095185 207320249 913488755 172070747 151599481 360834500 981583138 963868450 744261264 929703652 971847078 723367258 493528997 51953459 847885202 490909730
Output: 795931743

Example 2:

Input: 15 950881296 367647223 360324114 930968199 488128461 496563769 101306229 894168225 533370193 938313193 427605909 80243541 47864740 432017472 8679417
Output: 792861996

Example 3:

Input: 7 131005154 756129355 671214550 544978569 156159967 455051242 824004217
Output: 625124201

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Ysolde's coins Largest Step - EASY Coding Problem | CodeTikki