CT27902

Varun's stamps Largest Step

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Before the gates of the kelp forests of Tangledeep close for winter, Varun must finish the stamps ledger - one figure at a time. 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 <= 447; -100 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 241 980695 508274 400014 906904 480707 966180 8234 945658 112509 627425 255673 721175 196886 738601 685217 48831 337974 564485 812363 605105 139828 747619 313916 234294 217165 832506 746685 706430 433455 855384 136174 513304 900358 49056 806911 878154 816868 965987 806436 24976 481656 669438 245939 255060 68259 988784 49942 419370 435449 477975 639524 388955 571232 4693 251328 368104 520221 289812 875476 646128 919760 711738 412723 594211 637008 3678 705917 308259 862176 673748 570934 56172 272352 338180 445709 299729 25264 618256 375417 189880 882668 949079 690252 520789 247273 500170 225188 882271 6558 88223 55718 663887 221103 728825 521620 829930 861257 183419 819454 288764 531766 204277 761630 13394 619210 678545 516981 441282 553854 90382 916697 209448 140765 555365 237771 689150 338…
Output: 957946

Example 2:

Input: 320 279804 108614 444876 989600 789267 314290 611989 947476 823324 306191 235173 821756 697340 771236 603065 409763 471861 795779 837911 357363 548091 740457 671375 858649 65224 547732 595590 61348 301246 675349 830673 784984 403246 785580 931914 187622 48051 433881 11050 887150 609021 793722 278627 970425 835494 638372 352380 655470 186148 491828 415616 329659 348687 685102 186538 631135 210285 236695 259451 384771 245723 62198 381140 891931 602348 725886 459049 121741 183434 604756 992818 505909 856870 436428 562168 835923 225605 460787 809055 27514 643662 951177 379038 81017 587853 206774 502219 413910 956051 177259 139226 199514 492000 907797 805880 86123 715763 82251 427686 578731 328577 490471 246489 213061 336427 61408 927078 662346 3537 727733 719039 743331 358649 800326 580570 624…
Output: 915691

Example 3:

Input: 418 90775 104310 792336 906086 213936 992814 7508 87813 360300 821443 318171 806984 907703 362768 445842 980580 676426 510475 233424 975559 134293 348502 106492 544018 125707 90555 741468 316319 240248 634140 692081 798287 351267 58622 176463 821550 145805 985113 553353 116120 676750 287621 582781 506568 14778 974836 731799 523909 884177 8881 40649 652189 61450 143599 769176 595183 207564 376791 447108 175792 329160 538932 390651 684953 587402 228580 683234 380209 167738 389433 288750 516089 928972 267586 973612 75776 785287 530998 480873 98625 229967 512353 119869 432600 535667 159754 935764 49275 672422 918029 857626 946095 660383 132061 440208 999559 638889 521347 846004 220992 776788 146658 675114 371036 981947 311380 558063 608467 7340 838660 430128 205023 488871 167687 104530 668779 …
Output: 985306

Constraints:

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

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