CT33651

The Closest Pair of Briarthorn

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Every season at the forest village of Briarthorn, someone must tally the donation drive. This year the task falls to Keeper, armed only with the crates 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 <= 8099; 0 <= a[i] <= 1000.

Example 1:

Input: 4641 216 758 100 830 82 578 360 936 93 407 281 46 895 361 675 207 122 157 81 741 486 734 414 702 728 935 95 974 910 828 499 639 252 298 35 840 141 794 792 779 889 940 715 802 849 84 450 149 484 424 38 711 635 465 840 920 962 733 23 647 368 337 693 348 338 738 252 716 755 178 967 555 521 359 978 116 781 99 685 171 630 212 414 197 975 513 85 11 413 405 936 778 646 418 610 838 432 110 498 293 928 338 709 575 811 641 524 142 6 641 359 997 639 94 286 471 444 24 884 785 66 976 470 375 83 225 823 898 168 954 277 755 882 966 857 756 562 508 443 894 468 685 314 734 269 827 768 30 410 6 262 345 728 657 268 839 615 348 614 212 33 704 34 873 724 187 958 676 624 779 962 803 749 203 373 843 147 165 356 184 43 971 628 325 99 666 451 241 166 531 513 173 100 302 284 610 136 700 745 264 145 471 939 588 497 …
Output: 0

Example 2:

Input: 2199 57 184 573 151 37 733 111 363 799 457 376 367 400 822 72 337 247 652 513 444 537 713 984 637 200 385 654 882 638 390 495 450 586 570 591 749 449 7 531 58 531 140 178 98 140 225 218 602 393 667 595 935 171 791 982 453 970 896 156 182 462 550 818 542 683 380 344 980 364 856 733 447 589 278 355 685 453 560 984 221 30 458 107 752 210 626 957 36 270 973 389 407 888 314 453 428 316 228 659 421 411 331 113 474 752 707 284 804 132 712 328 428 639 927 716 915 256 48 451 701 759 209 89 209 94 581 541 62 468 508 568 10 889 63 681 594 723 650 232 399 259 137 315 398 276 854 942 847 22 771 885 833 61 284 698 0 95 862 984 609 629 514 439 816 896 948 571 578 346 673 905 873 32 763 797 669 165 220 853 919 747 58 256 809 984 799 331 565 721 0 159 424 233 371 711 995 836 644 29 650 250 111 162 799 365 …
Output: 0

Example 3:

Input: 4461 707 259 20 187 496 212 50 51 804 825 788 811 360 973 554 354 598 76 163 188 332 687 337 23 360 623 215 98 948 811 755 534 628 357 526 333 770 45 836 29 396 403 100 721 182 4 667 803 329 761 702 458 797 28 272 630 401 18 341 269 426 176 939 739 851 807 356 107 510 558 119 463 480 463 389 997 69 925 171 629 319 931 398 594 126 434 160 840 473 732 213 828 167 94 944 848 607 300 735 974 298 803 0 134 193 257 85 314 737 231 386 854 671 917 990 36 37 910 856 508 687 860 114 492 155 795 429 744 78 789 336 453 432 567 674 486 722 563 366 635 749 452 166 944 569 97 868 366 802 453 744 306 770 630 827 2 171 261 596 192 899 321 817 318 363 528 19 219 531 884 607 445 654 322 557 368 179 528 359 90 959 569 26 727 189 965 900 699 554 719 128 561 170 551 27 893 823 843 766 283 78 796 628 401 155 548…
Output: 0

Constraints:

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

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