CT926

Woven stamps Widest Spread

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Orin inherited the lighthouse at the gristmill of Rye Hollow along with its curious bookkeeping system for stamps. Time to make sense of it. Task: Read n integers and print the difference between the largest and smallest. Input format: First line: n. Second line: n space-separated integers. Output format: Print max(a) - min(a). Constraints: 1 <= n <= 70; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 30 945 421 314 981 482 960 796 755 620 73 866 480 307 726 169 2 978 256 205 167 275 152 349 80 117 767 706 807 736 147
Output: 979

Example 2:

Input: 51 184 976 11 -18 458 322 31 -8 -40 745 993 712 230 695 576 820 -8 -33 787 865 999 857 101 952 96 332 121 764 -22 256 46 319 132 619 443 752 133 182 197 758 768 831 449 -48 -61 430 242 69 133 -51 489
Output: 1060

Example 3:

Input: 63 386 40 678 737 269 123 -24 445 866 258 836 729 416 -30 809 362 281 10 265 564 925 456 846 400 301 25 631 135 324 439 742 104 422 332 831 598 334 979 369 401 827 190 628 841 928 430 559 -75 154 26 743 242 853 187 784 427 486 -66 608 474 48 751 71
Output: 1054

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Woven stamps Widest Spread - EASY Coding Problem | CodeTikki