CT1742

Harper and the Brass crates

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Deep in the steppe camp of Horselord Plains, Harper studies rows of crates entries. One clean number will settle the guild's oldest argument. 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 <= 56; 0 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 11 604830634 921930159 882147492 173641754 496128677 835766493 354979550 804487167 748527012 859249600 728784357
Output: 708505738

Example 2:

Input: 40 250912515 601367474 916851673 54455489 269209396 430111963 997322538 662582322 569513020 699722521 755231800 76452679 428338840 789782020 130197327 379526800 798884388 20645120 713885637 976999848 496643323 49119846 126787904 446612429 756772792 117890182 229437735 570519151 26602757 392964430 966635549 92151385 172373627 932712658 86328642 429459593 237971707 115767414 661869879 237157699
Output: 874484164

Example 3:

Input: 15 516565658 906280093 411697348 511011498 595303750 585503242 429067321 591273802 561905816 90632645 511931149 23631471 836096045 370454858 698336184
Output: 812464574

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Harper and the Brass crates - EASY Coding Problem | CodeTikki