CT33564

Minstrel's Whispering ledgers

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Every season at the cotton rows of Whitewick, someone must track down a clerical error. This year the task falls to Minstrel, armed only with the ledgers 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 <= 6426; 0 <= a[i] <= 1000000.

Example 1:

Input: 661 966789 664681 453456 154148 415040 750367 848549 260934 148517 491171 981850 529039 971085 490109 963686 407426 829983 668486 923800 105351 467340 674471 790123 381522 201209 813076 643584 694930 887743 260154 585774 44889 976377 274275 641082 139674 588246 585698 613405 896223 524121 705749 105731 757567 277841 92901 383918 22905 926818 880811 616811 19855 93495 827883 909898 893356 423096 168016 908837 887325 533515 480653 138605 394365 745536 532284 352122 350546 927499 871339 152289 34721 294254 623684 678879 686193 667031 601533 277515 770856 756669 922635 539509 593608 224394 528763 13646 341150 216681 918618 677418 849611 637365 689817 653552 335256 243212 968118 84067 400640 829681 411344 835479 257247 98910 447172 877617 272606 215842 82816 883395 839166 804312 131359 105601 5…
Output: 2

Example 2:

Input: 4061 171905 150220 310115 495918 820785 248997 546621 540760 644967 975647 396321 34054 951965 810576 303850 272551 648965 194187 235694 289924 122775 928389 687559 637320 443379 870273 551484 634421 830758 277277 516665 237860 501180 534374 117944 337776 681014 803134 98268 911562 25796 533192 496990 737311 901248 802898 595007 894953 565740 688189 163609 845016 127424 810059 885447 570508 305436 684224 327259 437449 75576 712407 254599 271324 46794 587602 975385 173807 718622 96637 798972 529139 595828 128559 688155 981841 69454 236050 91872 691549 304624 620208 294554 419805 772985 40858 441412 28617 916194 72455 253303 397130 504233 147708 620522 149567 10955 290996 167480 8121 381611 717202 298414 743185 237027 519725 215377 560878 112204 840581 430991 239570 15884 389173 908417 75198…
Output: 0

Example 3:

Input: 1000 373608 229881 165816 987405 827879 725188 855727 965453 43509 541450 709241 483503 707612 108040 494675 766101 846612 952300 578631 673133 600910 991590 91893 536468 914832 246449 22246 690513 213940 812973 485734 506375 134543 69677 829629 492660 323079 233324 462412 602991 292157 565503 683085 264532 647075 77969 240458 456394 589816 151577 690300 99742 116063 233453 741455 608978 777717 836138 740858 492670 335179 643623 515399 217921 905918 670320 351608 820395 629281 529023 360469 948780 52034 93249 413017 671855 427208 784110 984777 476680 184404 869365 131999 786063 593456 607258 607285 239762 418464 491091 272588 665845 709924 539371 682017 890182 254043 301100 20188 725756 48286 893899 571654 19313 46867 403039 304378 336285 714150 843172 141606 217153 361688 803236 707457 29…
Output: 1

Constraints:

2 <= n <= 6426; 0 <= a[i] <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
Minstrel's Whispering ledgers - MEDIUM Coding Problem | CodeTikki