CT33754

Ishaan and the Closest Pair

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Every season at the ribbon falls of Cascade Vale, someone must plan the festival budget. This year the task falls to Ishaan, armed only with the weights 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 <= 12684; 0 <= a[i] <= 1000.

Example 1:

Input: 3855 611 750 18 199 371 46 125 664 517 793 39 735 593 79 350 75 551 396 578 449 246 915 701 262 9 531 267 810 459 784 420 65 149 244 295 933 850 67 340 940 201 858 60 555 85 243 842 878 456 236 253 622 1 189 467 232 340 633 457 741 744 799 171 848 649 459 688 282 948 516 581 265 967 30 428 111 274 349 964 281 334 771 429 461 856 343 789 113 716 951 33 909 348 317 263 502 24 248 546 313 727 481 709 648 538 362 636 807 387 240 686 986 611 982 901 357 973 74 773 1000 368 553 852 757 980 157 665 538 467 705 161 218 424 58 859 183 914 874 896 699 713 651 28 76 779 63 982 655 488 86 148 367 101 249 611 853 741 275 149 89 256 944 766 51 507 360 429 207 803 734 74 779 265 739 449 987 623 368 840 793 63 632 878 956 62 171 325 563 766 958 615 192 867 838 128 195 306 690 885 283 698 452 672 839 827 3…
Output: 0

Example 2:

Input: 3027 955 895 359 631 37 311 928 27 119 121 943 424 567 208 851 174 5 920 316 694 85 97 929 352 289 289 221 560 115 981 665 261 928 687 460 187 194 517 853 387 348 150 503 399 329 938 695 890 928 934 965 368 353 987 996 756 986 489 531 440 789 585 292 635 250 521 863 931 209 326 643 881 771 305 51 803 130 957 698 542 306 2 907 717 52 119 765 685 0 488 247 190 847 651 182 622 134 791 298 458 526 339 735 369 835 699 166 647 883 603 284 59 924 22 148 875 904 403 538 957 455 35 655 899 939 510 122 121 399 138 427 915 596 928 872 591 703 178 412 71 716 302 239 142 714 519 600 240 479 879 696 857 306 189 204 284 575 255 995 821 701 218 687 961 682 978 933 316 993 398 845 992 76 357 746 139 291 920 666 817 393 41 852 499 692 591 862 654 325 913 1 700 837 919 926 391 301 471 916 13 472 521 665 38 7…
Output: 0

Example 3:

Input: 1011 763 779 555 210 128 176 400 61 688 702 583 166 74 454 624 75 453 108 291 68 146 339 501 246 176 616 501 342 163 773 101 793 994 82 540 905 479 902 445 292 279 6 738 270 367 844 595 31 985 221 585 14 352 606 187 570 726 671 886 291 320 830 988 69 66 497 556 530 38 749 495 620 910 497 63 791 533 571 887 526 803 61 917 870 559 958 946 426 547 98 170 834 931 317 840 604 719 257 96 589 371 804 11 686 644 371 591 270 193 333 422 240 8 477 1000 920 800 755 980 301 402 246 441 68 485 636 852 843 654 298 198 359 15 384 250 130 434 844 99 319 630 13 222 268 856 642 663 578 253 566 690 72 143 34 966 120 590 739 882 222 386 117 976 55 293 5 27 801 308 704 633 938 288 319 189 902 133 183 629 233 898 776 405 119 925 19 31 773 969 321 847 659 268 675 714 401 978 676 147 488 896 905 90 671 3 814 832 …
Output: 0

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Ishaan and the Closest Pair - MEDIUM Coding Problem | CodeTikki