CT28769

Saffron registers Closest Pair

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Every season at the pine barrens of Needlepoint, someone must document the rare sighting. This year the task falls to Envoy, armed only with the registers register. 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 <= 338; -1000000 <= a[i] <= 1000.

Example 1:

Input: 121 -899842 -580584 -626570 -328777 -528542 -617698 -287955 -506501 -96596 -650210 -454346 -346556 -990038 -563471 -350702 -90621 -666446 -762986 -950247 -226452 -15388 -732728 -195781 -938431 -12638 -931051 -640859 -436840 -667377 -173918 -456315 -372908 -109582 -648021 -840724 -20305 -159208 -765226 -42605 -758609 -798220 -40667 -502949 -485687 -559367 -833510 -744320 -277034 -430856 -450850 -995167 -660952 -16850 -604063 -313606 -33172 -29280 -937986 -575108 -535420 -281881 -928434 -791169 -119582 -198948 -361806 -272534 -284869 -774981 -900087 -949607 -186710 -110762 -982560 -263239 -644378 -504866 -26777 -632394 -80786 -821145 -916035 -78015 -611665 -435594 -57000 -974955 -55743 -410015 -640922 -275261 -351469 -274735 -248685 -190432 -619606 -569787 -906465 -704346 -322313 -442466 -41…
Output: 63

Example 2:

Input: 275 -48920 -394217 -105417 -165216 -222497 -975450 -431427 -659709 -899386 -393840 -793816 -151662 -415526 -911032 -191741 -157729 -148133 -385530 -46080 -14351 -16406 -935945 -812488 -29809 -763816 -1808 -619831 -694275 -584895 -763016 -86696 -783384 -261029 -160905 -483962 -615627 -542511 -759485 -834664 -504714 -981896 -339717 -207890 -467299 -99547 -511094 -43831 -954975 -845902 -7517 -755401 -72993 -237765 -63861 -10187 -929933 -778976 -125896 -32498 -116453 -234644 -67651 -703332 -899922 -643419 -387726 -881685 -383000 -817383 -693599 -84005 -937479 -139827 -534417 -833123 -64467 -938271 -179751 -248254 -497885 -878136 -204607 -50012 -951137 -172281 -412803 -948050 -775241 -697171 -158764 -321811 -403731 -523688 -275673 -103617 -414615 -712257 -714460 -877484 -773781 -964162 -224773 …
Output: 2

Example 3:

Input: 226 -174368 -499442 -718634 -322237 -858271 -548211 -527356 -594562 -766220 -15504 -836810 -395755 -616757 -775078 -359785 -511582 -266057 -487899 -248718 -20913 -129723 -538173 -128297 -856070 -36705 -154384 -305666 -987633 -250174 -42380 -859666 -75343 -924033 -201035 -694506 -808972 -735853 -793222 -817190 -96541 -188688 -344268 -840703 -539111 -894073 -409167 -400341 -355051 -179088 -637006 -336300 -560116 -881177 -511313 -604048 -927025 -390922 -330867 -546969 -938004 -87456 -545793 -21530 -811814 -17018 -314636 -633746 -404293 -703996 -595061 -599924 -556669 -867073 -236486 -579640 -906068 -65222 -955029 -753035 -137335 -284894 -139367 -766764 -526385 -538920 -138333 -456633 -131138 -838857 -888670 -881403 -520000 -962400 -219093 -346342 -200993 -914668 -688872 -856242 -445016 -78757…
Output: 2

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Saffron registers Closest Pair - EASY Coding Problem | CodeTikki