{ "id": 2634, "name": "minimum_common_value", "difficulty": "Easy", "link": "https://leetcode.com/problems/minimum-common-value/", "date": "2023-01-07 00:00:00", "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.", "public_test_cases": [ { "label": "Example 1", "input": "nums1 = [1,2,3], nums2 = [2,4]", "output": "2 " }, { "label": "Example 2", "input": "nums1 = [1,2,3,6], nums2 = [2,3,4,5]", "output": "2 " } ], "private_test_cases": [ { "input": [ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 83, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 ], [ 1, 3, 20, 21, 22, 25, 26, 32, 37, 38, 39, 40, 42, 43, 44, 46, 48, 50, 56, 57, 58, 59, 67, 68, 69, 71, 72, 80, 83, 87, 89, 92, 93, 96 ] ], "output": 1 }, { "input": [ [ 1, 2, 4, 5, 11, 12, 13, 14, 19, 23, 26, 35, 38, 40, 42, 45, 47, 49, 51, 52, 57, 58, 59, 60, 63, 66, 68, 69, 71, 75, 81, 89, 91, 93, 95 ], [ 1, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 22, 23, 24, 26, 28, 29, 30, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 58, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 74, 76, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100 ] ], "output": 1 }, { "input": [ [ 1, 3, 8, 10, 14, 16, 19, 27, 28, 32, 34, 35, 37, 42, 44, 47, 55, 57, 61, 65, 67, 69, 70, 73, 76, 80, 84, 85, 89, 90, 91, 95, 98, 100 ], [ 56, 76, 82, 88, 89, 90 ] ], "output": 76 }, { "input": [ [ 11, 13, 15, 18, 19, 25, 33, 43, 44, 45, 49, 52, 55, 71, 72, 76, 84, 89, 90, 91, 97 ], [ 1, 6, 8, 9, 13, 14, 15, 25, 28, 29, 35, 36, 43, 45, 47, 49, 53, 54, 61, 68, 72, 74, 82, 84, 86, 90, 92, 93, 94, 96, 98 ] ], "output": 13 }, { "input": [ [ 3, 5, 6, 13, 14, 16, 17, 20, 21, 22, 24, 26, 27, 28, 29, 34, 37, 38, 39, 41, 42, 43, 45, 47, 48, 50, 51, 52, 53, 57, 58, 59, 60, 62, 64, 65, 67, 68, 72, 74, 76, 77, 78, 79, 80, 82, 83, 84, 86, 87, 89, 91, 93, 94, 95, 96, 98, 99 ], [ 2, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 22, 24, 25, 26, 27, 30, 32, 33, 35, 36, 38, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 64, 67, 68, 70, 71, 76, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 96, 98, 99, 100 ] ], "output": 5 }, { "input": [ [ 2, 5, 6, 7, 9, 10, 11, 13, 14, 15, 17, 21, 26, 27, 28, 29, 31, 33, 35, 36, 38, 39, 42, 43, 44, 48, 49, 54, 55, 56, 57, 59, 61, 62, 67, 72, 73, 76, 77, 81, 82, 83, 85, 86, 87, 88, 90, 92, 93, 95, 96, 99 ], [ 101, 103, 104, 105, 106, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 126, 127, 128, 129, 131, 132, 134, 135, 136, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 148, 150, 152, 153, 156, 158, 159, 160, 161, 163, 164, 165, 167, 168, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 190, 191, 192, 194, 196, 197, 198, 199, 200 ] ], "output": -1 }, { "input": [ [ 4, 31, 55, 59, 80 ], [ 102, 104, 105, 106, 107, 108, 109, 110, 111, 114, 115, 116, 117, 118, 121, 123, 124, 126, 127, 128, 129, 133, 134, 135, 137, 140, 141, 142, 145, 146, 147, 150, 151, 153, 155, 157, 160, 163, 167, 168, 172, 173, 175, 176, 177, 178, 179, 188, 189, 190, 196, 198, 200 ] ], "output": -1 }, { "input": [ [ 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99 ], [ 101, 102, 103, 104, 105, 107, 108, 109, 110, 112, 113, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 128, 129, 131, 132, 133, 134, 135, 136, 137, 138, 140, 141, 142, 143, 144, 145, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177, 178, 179, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200 ] ], "output": -1 }, { "input": [ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 ], [ 101, 103, 104, 105, 106, 108, 109, 110, 112, 114, 115, 117, 118, 119, 120, 122, 124, 125, 126, 127, 129, 131, 133, 134, 135, 138, 140, 141, 144, 145, 146, 147, 152, 153, 154, 157, 158, 159, 160, 162, 163, 164, 165, 167, 168, 170, 172, 177, 179, 181, 183, 187, 188, 189, 190, 191, 192, 194, 200 ] ], "output": -1 }, { "input": [ [ 5, 8, 9, 12, 13, 15, 21, 23, 24, 25, 28, 30, 31, 32, 33, 36, 44, 45, 49, 52, 56, 58, 61, 68, 72, 75, 76, 79, 80, 84, 87, 88, 90, 91, 92, 94, 97 ], [ 103, 108, 113, 116, 141, 146, 151, 162, 168, 171, 173, 176, 182, 199 ] ], "output": -1 } ], "haskell_template": "getCommon :: [Int] -> [Int] -> Int\ngetCommon nums1 nums2 ", "ocaml_template": "let getCommon (nums1: int list) (nums2: int list) : int = ", "scala_template": "def getCommon(nums1: List[Int],nums2: List[Int]): Int = { \n \n}", "java_template": "class Solution {\n public int getCommon(int[] nums1, int[] nums2) {\n \n }\n}", "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 " }