CT32452

Nora's Polished Ledger

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

In the gull cliffs of Screech Point, Nora the accountant keeps careful count of the ledgers. Track down a clerical error, every figure matters. Task: Print the minimum absolute difference between any two array elements. Input format: First line: n (>=2). Second line: n integers. Output format: Print the minimum pairwise absolute difference. Constraints: 2 <= n <= 5913; -1000000 <= a[i] <= 1000.

Example 1:

Input: 421 -17502 -25804 -237880 -762295 -846470 -241556 -689014 -147407 -224181 -726712 -283025 -344359 -883765 -552639 -981391 -249910 -873358 -282415 -236316 -760560 -386498 -267633 -401043 -749529 -534267 -107229 -290090 -58072 -183093 -144298 -337613 -707916 -358955 -572796 -718743 -100875 -806778 -364741 -789907 -673240 -778080 -210156 -681515 -211765 -855617 -610998 -384063 -136118 -170304 -155684 -570914 -931167 -919473 -892940 -691805 -769204 -628581 -189675 -449707 -412565 -460104 -509909 -870163 -422281 -918151 -42813 -515249 -481568 -109103 -732491 -560574 -590037 -818021 -430986 -246851 -73000 -716191 -591792 -793424 -96470 -301887 -535727 -448024 -540646 -371495 -480845 -417440 -776072 -254183 -265888 -317307 -108925 -730369 -645509 -971462 -838193 -844390 -498826 -255925 -237678 -9…
Output: 13

Example 2:

Input: 529 -188024 -493032 -988931 -500447 -906625 -152705 -569380 -790349 -961135 -346020 -901929 -563260 -544020 -549645 -688174 -505336 -879829 -422684 -635303 -347734 -592727 -197227 -128546 -483981 -983382 -711123 361 -624824 -4118 -40359 -843020 -818024 -552336 -540021 -439639 -3729 -118427 -865163 -212283 -402914 -241536 -285887 -409692 -443599 -785679 -812644 -302802 -55011 -54278 -982018 -189043 -551520 -16599 -308729 -640597 -74476 -722179 -943965 -132501 -104510 -964944 -532678 -108699 -319499 -692128 -902916 -571365 -220075 -950710 -84273 -980191 -605175 -52013 -476040 -533136 -934106 -364301 -248127 -898693 -110407 -288224 -689051 -874478 -153524 -751138 -559352 -425347 -520737 396 -949255 -990267 -986185 -541188 -321809 -196856 -77124 -474811 -65149 -353259 -115712 -981465 -925687 -…
Output: 2

Example 3:

Input: 3930 -581723 -504714 -452811 -275060 -85515 -53464 -760636 -924618 -279709 -323078 -326875 -279244 -434596 -265889 -371342 -233255 -79885 -871577 -133164 -485403 -920161 -624168 -670869 -510448 -212997 -821556 -864240 -691525 -73298 -758288 -797135 -594865 -507290 -76443 -419446 -986165 -288741 -158242 -101005 -641554 -128297 -387759 -659902 -932650 -835734 -804507 -511328 -660190 -785980 -498712 -600625 -894938 -495240 -231946 -8760 -56847 -38673 -191682 -932045 -883486 -777171 -356205 -354198 -683772 -280537 -504620 -122707 -46031 -154161 -100987 -221412 -991506 -810119 -462618 -574978 -49021 -215061 -584795 -627900 -733886 -66947 -280441 -167831 -514536 -384084 -90 -752788 -338485 -182784 -870502 -335674 -964928 -703797 -587617 -409892 -922654 -697391 -156950 -731653 -458024 -243009 -85…
Output: 0

Constraints:

2 <= n <= 5913; -1000000 <= a[i] <= 1000.

Loading...
Test Cases:No test cases
No test cases available.
Nora's Polished Ledger - MEDIUM Coding Problem | CodeTikki