You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Given two 0-indexed integer arrays nums1 and nums2, return a list answer of size 2 where:
3
+
4
+
// answer[0] is a list of all distinct integers in nums1 which are not present in nums2.
5
+
// answer[1] is a list of all distinct integers in nums2 which are not present in nums1.
6
+
// Note that the integers in the lists may be returned in any order.
7
+
8
+
// Example 1:
9
+
// Input: nums1 = [1,2,3], nums2 = [2,4,6]
10
+
// Output: [[1,3],[4,6]]
11
+
// Explanation:
12
+
// For nums1, nums1[1] = 2 is present at index 0 of nums2, whereas nums1[0] = 1 and nums1[2] = 3 are not present in nums2. Therefore, answer[0] = [1,3].
13
+
// For nums2, nums2[0] = 2 is present at index 1 of nums1, whereas nums2[1] = 4 and nums2[2] = 6 are not present in nums2. Therefore, answer[1] = [4,6].
14
+
// Example 2:
15
+
// Input: nums1 = [1,2,3,3], nums2 = [1,1,2,2]
16
+
// Output: [[3],[]]
17
+
// Explanation:
18
+
// For nums1, nums1[2] and nums1[3] are not present in nums2. Since nums1[2] == nums1[3], their value is only included once and answer[0] = [3].
19
+
// Every integer in nums2 is present in nums1. Therefore, answer[1] = [].
// Given a 2D integer array nums where nums[i] is a non-empty array of distinct positive integers, return the list of integers that are present in each array of nums sorted in ascending order.
// 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.
3
+
4
+
// Note that an integer is said to be common to nums1 and nums2 if both arrays have at least one occurrence of that integer.
5
+
6
+
// Example 1:
7
+
// Input: nums1 = [1,2,3], nums2 = [2,4]
8
+
// Output: 2
9
+
// Explanation: The smallest element common to both arrays is 2, so we return 2.
10
+
// Example 2:
11
+
// Input: nums1 = [1,2,3,6], nums2 = [2,3,4,5]
12
+
// Output: 2
13
+
// Explanation: There are two common elements in the array 2 and 3 out of which 2 is the smallest, so 2 is returned.
14
+
15
+
// Constraints:
16
+
// 1 <= nums1.length, nums2.length <= 105
17
+
// 1 <= nums1[i], nums2[j] <= 109
18
+
// Both nums1 and nums2 are sorted in non-decreasing order.
0 commit comments