CT33079

The Closest Pair Beneath Sandspire

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Finn the tallyman watches over the desert outpost of Sandspire's stores of crates. A careful computation stands between order and chaos. 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 <= 10071; 0 <= a[i] <= 1000.

Example 1:

Input: 2878 241 227 4 858 674 297 287 186 990 516 647 412 945 760 993 556 512 585 368 112 542 226 162 438 648 763 660 619 427 784 767 146 371 572 677 915 908 883 157 459 782 323 345 894 800 82 765 775 32 127 242 408 942 20 267 796 626 980 820 390 548 605 195 242 218 695 611 617 24 469 112 373 155 713 10 590 565 50 156 610 623 516 451 667 999 282 234 548 832 8 225 223 965 635 429 843 762 694 5 571 617 947 307 680 435 604 303 800 119 992 469 135 298 454 409 79 909 533 628 93 737 846 693 19 936 223 325 362 788 922 632 636 165 639 675 262 102 782 625 722 247 410 610 422 955 402 837 229 328 549 557 265 239 713 647 200 250 47 52 628 678 495 932 256 401 633 170 524 458 3 730 563 774 483 941 627 506 531 316 781 951 437 586 573 234 319 365 765 735 163 263 243 405 585 335 299 416 784 243 93 558 715 79 935 …
Output: 0

Example 2:

Input: 1143 604 134 110 442 271 804 45 206 367 817 653 203 148 769 765 719 286 174 147 875 906 283 847 667 547 661 156 591 108 447 109 187 587 416 778 408 180 62 769 193 430 639 266 449 751 130 125 836 754 689 304 419 594 311 873 228 266 702 507 781 160 212 715 233 450 762 752 767 487 32 531 142 629 58 989 504 320 810 14 263 77 40 816 923 860 9 178 667 142 842 426 168 644 478 159 379 165 271 144 434 146 109 369 54 279 638 638 130 567 456 270 871 557 718 604 391 780 664 925 849 23 792 576 455 742 793 417 390 280 373 336 175 452 788 988 490 236 910 381 814 672 248 936 133 387 426 443 255 693 126 177 573 558 722 353 572 243 45 705 155 105 332 133 93 685 409 408 367 806 96 820 837 26 732 52 60 725 384 33 337 381 684 964 71 920 534 637 57 907 49 294 604 110 765 713 406 647 707 928 547 103 140 525 929 …
Output: 0

Example 3:

Input: 5227 463 475 931 774 746 252 857 214 459 721 101 773 84 753 263 835 314 973 436 891 23 652 698 425 886 462 793 824 12 968 683 129 159 403 924 304 998 143 618 591 439 818 619 712 906 684 749 289 694 78 160 560 41 893 60 794 753 731 289 93 69 451 392 647 788 181 95 797 353 972 176 256 971 411 335 338 160 142 19 2 714 592 855 380 629 680 410 838 620 876 964 407 976 34 291 810 175 276 129 684 108 518 664 512 166 390 992 926 643 580 721 530 591 910 734 415 35 107 762 229 338 232 426 381 901 451 616 214 824 832 839 986 718 331 957 828 992 850 269 717 37 402 904 251 83 256 791 191 602 177 538 772 329 899 335 374 420 358 842 190 290 397 857 593 102 314 214 625 228 553 64 897 19 891 630 799 34 455 112 560 747 545 73 972 173 85 331 956 747 916 405 528 102 5 724 533 306 240 967 258 105 129 172 517 85…
Output: 0

Constraints:

2 <= n <= 10071; 0 <= a[i] <= 1000.

Loading...
Test Cases:No test cases
No test cases available.
The Closest Pair Beneath Sandspire - MEDIUM Coding Problem | CodeTikki