CT22871

Curator's crates Largest Step

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Legend says the vault under the lotus ponds of Tranquil Basin opens only for a perfect tally of crates. Curator means to find out. 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 <= 929; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 367 507911 880917 -326069 433710 482560 564603 681224 460013 -969058 647452 207796 -987874 -675643 380037 486233 -712612 734213 -634898 513964 -343182 -999077 706724 -910828 -26869 950468 563955 -975804 -231049 -257408 500811 989916 -286247 250379 -776270 470460 614553 -344295 -335010 -836342 183896 337285 741397 748526 864653 599312 295659 -787269 895106 -405321 -277159 837287 846564 399813 -425193 -798632 -971639 -648377 244024 -721114 945110 -849979 303262 524080 62511 -552271 519988 -503332 842276 -177182 167811 -538984 218048 828620 -149120 138202 640698 -844355 -785034 852700 327346 -910303 497962 179095 -930227 781206 -498547 884983 917982 828781 721424 334054 754311 106402 456015 111219 -488467 377350 -578337 -675268 829507 35276 -488341 -116248 357642 -688039 865514 -965011 791798…
Output: 1944572

Example 2:

Input: 924 -251366 644161 169184 -250606 765014 40019 399989 4063 845409 -484198 -783303 -397962 -773107 -546653 447731 362059 -175674 -577840 -449774 280407 -479403 -467634 -778296 -527205 -711216 507689 -620780 334940 531421 384469 -446135 -47611 -926568 -848079 847197 -648740 -611848 -122444 -496120 393626 272220 81140 9789 327474 -156585 833890 -188700 -456426 -155274 703649 -951718 895803 859704 532520 649795 -131392 -488972 -815590 -35330 757193 538071 642573 271441 -479310 -754784 808658 697588 -720738 -664220 210171 442174 582323 914799 -408593 736274 -536692 -413880 -862101 -67636 -15288 560876 125406 -984924 -84727 -488847 959566 -38412 719581 452995 694966 -374516 -956623 -446908 -165728 -17007 48451 -272405 -356072 175366 928588 97520 240955 295295 162460 -3287 -370038 64821 947974 39…
Output: 1914201

Example 3:

Input: 9 -390066 -825816 727175 645883 -304869 -669328 -127714 -700318 -625520
Output: 1552991

Constraints:

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

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