CT1212

The Will-o-Wisp Largest Step

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Wade inherited the shed at the fen lights of Will-o-Wisp along with its curious bookkeeping system for lanterns. Time to make sense of it. 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 <= 52; -1000000 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 28 793112143 219710843 402469171 886433290 403546141 293028816 614870943 589246279 798761964 39910438 627011294 478931755 35028855 348289348 110124606 884432124 95120435 579731545 994254372 408741076 950853150 948621862 527358414 212662178 894136938 208760573 55480022 371589766
Output: 789311689

Example 2:

Input: 20 342323255 930716721 558897629 320282834 284922417 297622508 334047253 879177935 914568028 858341376 783321411 484092401 971695208 26172084 646284270 718714649 670000648 981462061 932218170 466655354
Output: 945523124

Example 3:

Input: 37 490838307 651564777 559115091 140427356 502116127 765998533 925917390 38860770 386026990 850780133 708421932 859588979 32084753 33939194 341613233 867568829 385479670 553878209 810142233 914914090 51207271 140469223 274248560 407828045 38626655 250064174 506684407 506648297 472083734 674883941 61042803 410755870 5754753 294283116 482038 380620980 844207187
Output: 887056620

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Will-o-Wisp Largest Step - EASY Coding Problem | CodeTikki