CT22457

The Largest Step of Tangledeep

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Legend says the vault under the kelp forests of Tangledeep opens only for a perfect tally of lanterns. Manav 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 <= 840; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 42 949 886 11 911 82 771 394 386 953 -54 214 918 245 714 155 524 -6 658 664 125 294 2 344 817 664 243 930 346 593 284 644 642 55 665 799 257 452 729 990 -83 732 657
Output: 1073

Example 2:

Input: 252 825 367 191 272 227 -97 157 890 87 804 -69 311 -25 402 939 -44 905 56 621 -26 265 293 42 573 775 803 118 342 351 515 103 535 8 792 351 808 665 985 498 530 866 58 328 757 658 191 954 240 396 142 737 71 -10 465 -91 -40 829 764 432 515 -52 376 33 119 286 483 139 -16 271 266 153 569 152 391 726 696 -64 -46 648 347 794 28 946 540 223 392 504 150 777 460 123 -41 -86 171 479 137 582 926 635 269 -28 320 363 591 582 588 -41 12 809 713 994 389 877 -30 869 800 -24 -59 239 -22 -59 771 431 -70 316 768 -83 -6 641 734 956 612 760 420 175 -32 50 536 853 708 822 662 708 252 76 527 42 -44 348 105 155 562 989 165 898 167 335 402 986 515 -45 822 26 103 30 506 30 492 234 659 675 462 170 872 56 989 526 991 121 822 726 548 434 798 224 -32 -87 404 602 186 366 921 221 531 769 968 580 342 294 766 872 -9 55 384 …
Output: 1031

Example 3:

Input: 728 651 14 658 653 57 -83 279 986 579 -8 626 803 448 874 758 149 47 761 75 917 468 34 755 796 33 426 447 455 592 494 976 497 53 123 333 48 239 -54 734 670 230 446 426 104 664 128 569 80 141 995 627 127 62 -69 493 862 339 635 689 325 799 413 49 729 149 18 379 -18 127 635 646 320 595 747 217 676 617 498 129 -81 889 440 208 343 429 406 563 272 -54 281 58 258 215 17 490 676 723 204 735 838 303 975 241 275 -14 219 732 997 237 440 -45 -75 864 626 447 567 868 905 267 556 -2 897 514 616 107 452 350 515 708 202 725 541 223 357 161 814 868 0 837 667 171 575 379 847 990 24 963 125 663 746 162 16 679 342 141 -61 434 818 225 589 569 888 678 694 196 687 542 184 863 212 329 223 693 838 547 626 397 588 646 303 308 835 749 563 382 869 621 384 362 506 644 918 527 440 479 305 494 727 313 874 468 472 926 702 …
Output: 1056

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Largest Step of Tangledeep - EASY Coding Problem | CodeTikki