CT886

Wheelwright's Largest Step Ledger

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

At the orchard lands of Applerun, Wheelwright records each readings in a worn leather ledger. The guild wants answers, not guesses. 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 <= 100; -100 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 3 -7 -30 -95
Output: 65

Example 2:

Input: 58 -75 -75 -2 8 -43 -90 -23 -24 -42 -100 -84 -68 -23 -72 -14 4 -65 2 -36 -41 -77 -2 -16 -21 -88 -94 -83 -65 -52 -55 -67 -22 -87 -81 1 -94 -85 6 1 -25 -81 -32 -38 -90 4 -32 10 -1 -59 -9 -36 -20 -89 -29 -77 5 -94 -83
Output: 99

Example 3:

Input: 87 -6 -91 -28 -58 -11 -21 -91 -33 -94 6 1 -98 -51 -33 -86 -71 -21 -4 -18 -54 -82 6 -95 -12 -7 5 -46 -95 -75 -20 -90 -91 9 -78 -70 -38 -24 -1 0 -99 -81 0 -99 -61 -36 -5 -52 -89 -85 -99 -4 -52 -5 -64 -14 -3 -5 -58 -9 -85 -18 -98 -42 -5 -42 -99 6 -69 -83 -65 -10 -93 -90 9 -69 -52 -10 -18 9 -36 -100 -91 -35 -21 0 -90 -34
Output: 105

Constraints:

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

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