CT27095

Rune Counts the lanterns

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

At the galleon yard of Masthead, Rune records each lanterns 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 <= 898; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 234 -26907 191491 519676 -603637 964383 -99557 -676380 550601 -402771 982536 403880 222770 784438 438751 491236 929778 369290 -141528 -139990 143312 497489 968129 902812 -998953 677417 -392456 -101729 -550260 -365484 180218 -555465 137010 -234670 932768 317260 623031 168589 442877 -572493 243006 -680374 865001 923514 -377360 242891 -54004 304588 -534336 447821 -798523 826489 -127104 -749151 -568062 942130 -259998 163295 -785015 736516 -346941 106010 -612894 483862 -152436 -291865 -843627 -990358 607805 -941893 817278 931396 -477877 -51972 -544854 -521164 889476 278407 -211353 -157517 -251622 -589879 -429319 21198 264345 -154515 389928 -847129 522223 -146207 353595 -988776 -881230 402392 538315 482742 -607467 -237398 804400 -564647 -5567 -83812 39084 694508 3749 -369691 236323 63574 925401 …
Output: 1901765

Example 2:

Input: 241 -796776 404892 651833 53697 592311 -265232 -862169 -119229 -685407 -516583 -945757 -114024 114198 974408 893857 15655 -453730 714736 5251 899824 -728981 610428 -606937 -1878 -959812 -348547 -202117 632143 969372 -491577 871865 359616 -30082 -231379 486288 -184214 -201036 533369 451151 -620162 -547624 -933565 -459776 152271 404095 -484791 -567089 311167 21012 -475493 -542981 168921 251962 -110242 -40982 -211927 -205598 64783 -588155 376037 -16727 179663 83312 -295542 2592 449084 -463508 24130 -714498 126812 -624986 -798174 494574 431336 -565027 534876 -135039 858730 -521069 -262368 -447625 664494 172568 167389 -145995 -91593 837133 596818 843073 863856 -439307 695862 277672 726949 392826 807166 -564275 63542 160024 -820494 -111508 -699679 -666633 -679010 -577883 793667 256165 -848888 -2…
Output: 1720573

Example 3:

Input: 558 714412 -719833 143656 974752 741688 -941498 -760054 562601 379371 -533664 980280 512331 -753058 819134 926770 -784942 475092 609839 952545 -357235 -610175 474585 995970 -607516 848038 244020 -628124 213516 315267 -538979 -567263 -432508 -653357 -209035 -116014 120956 494010 -746737 707530 188668 931476 -471640 -145686 682083 -729012 122218 -419308 674682 -275381 966517 -600728 38153 328733 195311 681970 881640 973609 -574883 449275 -908912 -402110 -492062 315314 96700 -411898 -387655 -332632 -695817 -399145 9004 657143 -587534 -717709 188388 329825 -14374 591570 474509 188904 -42179 -240517 985334 923613 -322298 -625112 -72540 -696920 -737690 961068 909719 888111 496198 -415403 -32677 163136 -847533 303383 686734 177871 202478 -120377 -593288 -638303 494766 147330 837504 914704 -605272…
Output: 1871918

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Rune Counts the lanterns - EASY Coding Problem | CodeTikki