TheRealSamuel/LeetCodeProblem
0561
1{2 "id": 2634,3 "name": "minimum_common_value",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/minimum-common-value/",6 "date": "2023-01-07 00:00:00",7 "task_description": "Given two integer arrays `nums1` and `nums2`, sorted in non-decreasing order, return _the **minimum integer common** to both arrays_. If there is no common integer amongst `nums1` and `nums2`, return `-1`. Note that an integer is said to be **common** to `nums1` and `nums2` if both arrays have **at least one** occurrence of that integer. **Example 1:** ``` **Input:** nums1 = [1,2,3], nums2 = [2,4] **Output:** 2 **Explanation:** The smallest element common to both arrays is 2, so we return 2. ``` **Example 2:** ``` **Input:** nums1 = [1,2,3,6], nums2 = [2,3,4,5] **Output:** 2 **Explanation:** There are two common elements in the array 2 and 3 out of which 2 is the smallest, so 2 is returned. ``` **Constraints:** `1 <= nums1.length, nums2.length <= 105` `1 <= nums1[i], nums2[j] <= 109` Both `nums1` and `nums2` are sorted in **non-decreasing** order.",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums1 = [1,2,3], nums2 = [2,4]",12 "output": "2 "13 },14 {15 "label": "Example 2",16 "input": "nums1 = [1,2,3,6], nums2 = [2,3,4,5]",17 "output": "2 "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 [24 1,25 2,26 3,27 4,28 5,29 6,30 7,31 8,32 9,33 10,34 11,35 12,36 13,37 15,38 16,39 17,40 18,41 20,42 21,43 22,44 23,45 24,46 25,47 26,48 27,49 28,50 29,51 30,52 31,53 32,54 33,55 34,56 35,57 36,58 37,59 38,60 39,61 40,62 41,63 42,64 43,65 44,66 45,67 46,68 47,69 48,70 49,71 50,72 51,73 52,74 53,75 54,76 55,77 56,78 57,79 58,80 59,81 60,82 61,83 62,84 63,85 64,86 65,87 66,88 67,89 68,90 69,91 70,92 71,93 72,94 73,95 74,96 75,97 76,98 77,99 78,100 79,101 80,102 81,103 83,104 86,105 88,106 89,107 90,108 91,109 92,110 93,111 94,112 95,113 96,114 97,115 98,116 99,117 100118 ],119 [120 1,121 3,122 20,123 21,124 22,125 25,126 26,127 32,128 37,129 38,130 39,131 40,132 42,133 43,134 44,135 46,136 48,137 50,138 56,139 57,140 58,141 59,142 67,143 68,144 69,145 71,146 72,147 80,148 83,149 87,150 89,151 92,152 93,153 96154 ]155 ],156 "output": 1157 },158 {159 "input": [160 [161 1,162 2,163 4,164 5,165 11,166 12,167 13,168 14,169 19,170 23,171 26,172 35,173 38,174 40,175 42,176 45,177 47,178 49,179 51,180 52,181 57,182 58,183 59,184 60,185 63,186 66,187 68,188 69,189 71,190 75,191 81,192 89,193 91,194 93,195 95196 ],197 [198 1,199 3,200 4,201 5,202 7,203 8,204 9,205 10,206 11,207 12,208 13,209 14,210 15,211 16,212 18,213 19,214 20,215 22,216 23,217 24,218 26,219 28,220 29,221 30,222 33,223 34,224 35,225 36,226 37,227 38,228 40,229 41,230 42,231 43,232 44,233 45,234 46,235 47,236 48,237 49,238 51,239 52,240 53,241 55,242 58,243 60,244 61,245 62,246 63,247 64,248 65,249 66,250 67,251 68,252 69,253 70,254 74,255 76,256 79,257 80,258 81,259 82,260 83,261 84,262 85,263 86,264 87,265 88,266 89,267 90,268 91,269 92,270 93,271 94,272 95,273 96,274 97,275 99,276 100277 ]278 ],279 "output": 1280 },281 {282 "input": [283 [284 1,285 3,286 8,287 10,288 14,289 16,290 19,291 27,292 28,293 32,294 34,295 35,296 37,297 42,298 44,299 47,300 55,301 57,302 61,303 65,304 67,305 69,306 70,307 73,308 76,309 80,310 84,311 85,312 89,313 90,314 91,315 95,316 98,317 100318 ],319 [320 56,321 76,322 82,323 88,324 89,325 90326 ]327 ],328 "output": 76329 },330 {331 "input": [332 [333 11,334 13,335 15,336 18,337 19,338 25,339 33,340 43,341 44,342 45,343 49,344 52,345 55,346 71,347 72,348 76,349 84,350 89,351 90,352 91,353 97354 ],355 [356 1,357 6,358 8,359 9,360 13,361 14,362 15,363 25,364 28,365 29,366 35,367 36,368 43,369 45,370 47,371 49,372 53,373 54,374 61,375 68,376 72,377 74,378 82,379 84,380 86,381 90,382 92,383 93,384 94,385 96,386 98387 ]388 ],389 "output": 13390 },391 {392 "input": [393 [394 3,395 5,396 6,397 13,398 14,399 16,400 17,401 20,402 21,403 22,404 24,405 26,406 27,407 28,408 29,409 34,410 37,411 38,412 39,413 41,414 42,415 43,416 45,417 47,418 48,419 50,420 51,421 52,422 53,423 57,424 58,425 59,426 60,427 62,428 64,429 65,430 67,431 68,432 72,433 74,434 76,435 77,436 78,437 79,438 80,439 82,440 83,441 84,442 86,443 87,444 89,445 91,446 93,447 94,448 95,449 96,450 98,451 99452 ],453 [454 2,455 5,456 6,457 8,458 9,459 10,460 11,461 12,462 13,463 14,464 15,465 16,466 18,467 19,468 20,469 22,470 24,471 25,472 26,473 27,474 30,475 32,476 33,477 35,478 36,479 38,480 40,481 41,482 42,483 43,484 44,485 45,486 47,487 48,488 49,489 50,490 51,491 52,492 53,493 54,494 55,495 57,496 58,497 59,498 60,499 64,500 67,501 68,502 70,503 71,504 76,505 78,506 79,507 80,508 81,509 82,510 84,511 85,512 86,513 87,514 88,515 89,516 90,517 92,518 93,519 94,520 96,521 98,522 99,523 100524 ]525 ],526 "output": 5527 },528 {529 "input": [530 [531 2,532 5,533 6,534 7,535 9,536 10,537 11,538 13,539 14,540 15,541 17,542 21,543 26,544 27,545 28,546 29,547 31,548 33,549 35,550 36,551 38,552 39,553 42,554 43,555 44,556 48,557 49,558 54,559 55,560 56,561 57,562 59,563 61,564 62,565 67,566 72,567 73,568 76,569 77,570 81,571 82,572 83,573 85,574 86,575 87,576 88,577 90,578 92,579 93,580 95,581 96,582 99583 ],584 [585 101,586 103,587 104,588 105,589 106,590 107,591 108,592 109,593 110,594 111,595 113,596 114,597 115,598 116,599 117,600 118,601 119,602 120,603 121,604 122,605 123,606 126,607 127,608 128,609 129,610 131,611 132,612 134,613 135,614 136,615 137,616 138,617 140,618 141,619 142,620 143,621 144,622 145,623 146,624 147,625 148,626 150,627 152,628 153,629 156,630 158,631 159,632 160,633 161,634 163,635 164,636 165,637 167,638 168,639 170,640 171,641 172,642 173,643 174,644 175,645 176,646 177,647 178,648 179,649 180,650 181,651 182,652 183,653 184,654 185,655 186,656 187,657 188,658 190,659 191,660 192,661 194,662 196,663 197,664 198,665 199,666 200667 ]668 ],669 "output": -1670 },671 {672 "input": [673 [674 4,675 31,676 55,677 59,678 80679 ],680 [681 102,682 104,683 105,684 106,685 107,686 108,687 109,688 110,689 111,690 114,691 115,692 116,693 117,694 118,695 121,696 123,697 124,698 126,699 127,700 128,701 129,702 133,703 134,704 135,705 137,706 140,707 141,708 142,709 145,710 146,711 147,712 150,713 151,714 153,715 155,716 157,717 160,718 163,719 167,720 168,721 172,722 173,723 175,724 176,725 177,726 178,727 179,728 188,729 189,730 190,731 196,732 198,733 200734 ]735 ],736 "output": -1737 },738 {739 "input": [740 [741 1,742 2,743 3,744 4,745 5,746 6,747 8,748 9,749 10,750 12,751 13,752 14,753 15,754 16,755 17,756 18,757 19,758 20,759 21,760 22,761 23,762 24,763 25,764 26,765 27,766 28,767 30,768 31,769 32,770 33,771 34,772 35,773 36,774 37,775 38,776 39,777 40,778 41,779 42,780 43,781 44,782 45,783 46,784 47,785 48,786 49,787 50,788 51,789 52,790 53,791 54,792 55,793 57,794 58,795 59,796 60,797 61,798 62,799 63,800 64,801 65,802 66,803 67,804 68,805 69,806 70,807 71,808 72,809 73,810 74,811 75,812 76,813 77,814 78,815 79,816 81,817 82,818 83,819 84,820 85,821 86,822 87,823 88,824 89,825 90,826 92,827 93,828 94,829 95,830 96,831 97,832 98,833 99834 ],835 [836 101,837 102,838 103,839 104,840 105,841 107,842 108,843 109,844 110,845 112,846 113,847 115,848 116,849 117,850 118,851 119,852 120,853 121,854 123,855 124,856 125,857 126,858 128,859 129,860 131,861 132,862 133,863 134,864 135,865 136,866 137,867 138,868 140,869 141,870 142,871 143,872 144,873 145,874 147,875 148,876 149,877 150,878 151,879 153,880 154,881 155,882 156,883 157,884 158,885 159,886 160,887 161,888 162,889 163,890 166,891 167,892 168,893 169,894 170,895 172,896 173,897 174,898 175,899 176,900 177,901 178,902 179,903 181,904 182,905 183,906 185,907 186,908 187,909 188,910 189,911 190,912 191,913 192,914 193,915 194,916 195,917 196,918 197,919 198,920 199,921 200922 ]923 ],924 "output": -1925 },926 {927 "input": [928 [929 1,930 2,931 3,932 4,933 5,934 6,935 7,936 8,937 9,938 10,939 11,940 12,941 15,942 16,943 17,944 18,945 19,946 20,947 21,948 22,949 23,950 24,951 25,952 26,953 27,954 28,955 29,956 30,957 31,958 32,959 33,960 34,961 35,962 36,963 37,964 38,965 39,966 40,967 41,968 42,969 43,970 44,971 45,972 46,973 47,974 48,975 50,976 51,977 52,978 53,979 54,980 55,981 56,982 57,983 58,984 59,985 60,986 61,987 62,988 64,989 66,990 67,991 68,992 69,993 70,994 72,995 73,996 74,997 75,998 76,999 77,1000 78,1001 79,1002 80,1003 81,1004 82,1005 83,1006 84,1007 86,1008 87,1009 88,1010 89,1011 90,1012 91,1013 92,1014 93,1015 94,1016 95,1017 96,1018 97,1019 98,1020 99,1021 1001022 ],1023 [1024 101,1025 103,1026 104,1027 105,1028 106,1029 108,1030 109,1031 110,1032 112,1033 114,1034 115,1035 117,1036 118,1037 119,1038 120,1039 122,1040 124,1041 125,1042 126,1043 127,1044 129,1045 131,1046 133,1047 134,1048 135,1049 138,1050 140,1051 141,1052 144,1053 145,1054 146,1055 147,1056 152,1057 153,1058 154,1059 157,1060 158,1061 159,1062 160,1063 162,1064 163,1065 164,1066 165,1067 167,1068 168,1069 170,1070 172,1071 177,1072 179,1073 181,1074 183,1075 187,1076 188,1077 189,1078 190,1079 191,1080 192,1081 194,1082 2001083 ]1084 ],1085 "output": -11086 },1087 {1088 "input": [1089 [1090 5,1091 8,1092 9,1093 12,1094 13,1095 15,1096 21,1097 23,1098 24,1099 25,1100 28,1101 30,1102 31,1103 32,1104 33,1105 36,1106 44,1107 45,1108 49,1109 52,1110 56,1111 58,1112 61,1113 68,1114 72,1115 75,1116 76,1117 79,1118 80,1119 84,1120 87,1121 88,1122 90,1123 91,1124 92,1125 94,1126 971127 ],1128 [1129 103,1130 108,1131 113,1132 116,1133 141,1134 146,1135 151,1136 162,1137 168,1138 171,1139 173,1140 176,1141 182,1142 1991143 ]1144 ],1145 "output": -11146 }1147 ],1148 "haskell_template": "getCommon :: [Int] -> [Int] -> Int\ngetCommon nums1 nums2 ",1149 "ocaml_template": "let getCommon (nums1: int list) (nums2: int list) : int = ",1150 "scala_template": "def getCommon(nums1: List[Int],nums2: List[Int]): Int = { \n \n}",1151 "java_template": "class Solution {\n public int getCommon(int[] nums1, int[] nums2) {\n \n }\n}",1152 "python_template": "class Solution(object):\n def getCommon(self, nums1, nums2):\n \"\"\"\n :type nums1: List[int]\n :type nums2: List[int]\n :rtype: int\n \"\"\"\n "1153}