CT26382

The Widest Spread of the Marble barrels

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

At the rook towers of Chessfield, Qadir records each barrels in a worn leather ledger. The guild wants answers, not guesses. 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 <= 854; -100 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 659 -12 8 -99 -84 -93 -15 -41 -82 -18 -15 -30 -13 -5 -82 -62 -39 -83 -45 -5 -15 -83 -44 -57 -44 -70 -47 -64 -91 -96 -49 -38 -52 -51 -27 -28 -87 9 2 1 -49 -59 -78 -11 -20 -15 -27 -12 -41 -64 -69 -12 -42 -12 -11 -41 -16 -85 -79 -61 -59 5 -39 8 -70 -70 -17 -62 -92 -17 -95 -35 5 -13 6 -55 -51 -66 -92 -55 -47 -46 -47 -23 -51 -2 -99 -84 2 -83 -19 8 -73 -39 -43 -49 -62 -79 -66 -48 -16 -38 -11 -98 -13 -87 -41 -17 -15 -16 -47 -51 -12 -89 -43 -67 -87 -69 -88 -94 -46 -20 -57 -98 -47 -100 -43 -87 -63 -24 -78 -91 -12 -60 -23 -15 -55 -39 -11 -97 -45 -46 -12 -43 -40 -4 -20 -5 -80 10 -78 -26 -68 -75 -75 -65 2 -94 -17 -51 -1 -73 -72 -11 -24 -32 -12 -4 -56 -54 -20 -60 -32 -69 -93 -38 -10 -89 -50 -71 -12 -45 -19 -89 -21 -35 -1 -24 -25 -8 -8 -37 -60 -76 -54 -54 -3 -86 -8 -21 -51 -36 -59 -25 -50 -85 -26 -35 -3…
Output: 110

Example 2:

Input: 366 -68 -99 -95 -71 -76 -83 -54 -96 -40 -47 -61 -89 3 8 -21 -7 -19 -86 -38 -93 -42 1 -46 -13 -89 -49 -86 -2 1 -53 -96 4 -72 -77 -52 -75 -12 -81 -33 -28 -98 -29 4 -4 9 -15 9 9 -38 -49 9 -42 -88 7 -80 -79 -6 -71 -30 -53 -100 -55 -69 -20 -73 -83 3 2 -50 -18 -88 -91 -17 -75 -61 -60 -38 -95 -9 -72 0 -77 -51 -13 -2 -19 -15 -27 -89 -80 2 -98 -59 -11 1 -8 -15 -38 -12 -80 -50 -59 -51 -80 -98 -86 -94 -2 -40 -54 -99 -22 -38 -13 -43 -95 -85 -67 -49 -40 -39 5 -44 -69 -46 -97 -93 -8 -67 2 -13 -63 1 10 -22 9 -31 -76 7 -93 -38 -9 -85 0 -71 -73 -88 4 -40 -36 -78 -68 -44 -69 -7 -24 -40 6 -14 -97 -12 -6 -56 -54 5 -26 -76 -92 -81 -6 -69 -38 -60 -51 -70 -79 -12 -100 -23 -8 -59 6 -21 -86 -55 -23 -62 -74 -47 -33 -76 -4 -98 -92 -20 -31 -52 -30 -63 -16 -14 -42 -7 -68 -86 -81 -80 -92 -10 -94 6 -79 -48 -29 -62 -7 -2…
Output: 110

Example 3:

Input: 842 -84 -76 -32 -85 -4 -6 -56 -11 -100 -8 -81 -29 -28 -72 -14 2 -36 7 -46 -70 -69 -6 -76 -32 -15 -77 -21 -5 -48 -20 9 -67 -37 9 -38 -29 -46 -28 -60 -37 -68 -88 -46 -46 -11 -32 -87 -58 -86 5 -39 -95 -51 -31 -30 10 -63 -79 -70 -7 -90 -48 -17 -74 -84 -18 0 -66 7 -62 -66 -97 -51 -88 -77 -5 -10 -21 -16 -31 -83 2 -92 -8 -18 -69 -98 5 -44 -55 -40 -59 0 -30 -7 -24 -61 -39 -67 -91 -67 -20 -9 -9 -37 -28 -40 -11 -97 -77 -33 -94 -40 -86 -8 -82 -54 -70 -23 -23 -7 -36 -10 -23 -72 -69 -28 -13 -22 -24 -81 -52 7 -20 -3 -41 5 -3 -56 -75 -35 -19 -57 -13 -8 -27 -7 -92 -99 -84 -100 -89 -12 -30 -64 -12 -4 -76 -24 -67 -17 -7 -73 -81 -79 -38 3 -86 -86 -83 4 5 -71 -33 -60 5 -60 -7 -28 -23 -43 -45 -91 8 -70 -7 -99 -17 -28 -25 -5 -58 -75 -90 -9 -78 -95 -100 -7 -21 -35 -8 -17 -3 -18 -6 6 -29 -3 -4 -77 -39 -31 -63 -53…
Output: 110

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Widest Spread of the Marble barrels - EASY Coding Problem | CodeTikki