<p>Given two integer arrays <code>nums1</code> and <code>nums2</code>, sorted in non-decreasing order, return <em>the <strong>minimum integer common</strong> to both arrays</em>. If there is no common integer amongst <code>nums1</code> and <code>nums2</code>, return <code>-1</code>.</p>

<p>Note that an integer is said to be <strong>common</strong> to <code>nums1</code> and <code>nums2</code> if both arrays have <strong>at least one</strong> occurrence of that integer.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> nums1 = [1,2,3], nums2 = [2,4]
<strong>Output:</strong> 2
<strong>Explanation:</strong> The smallest element common to both arrays is 2, so we return 2.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> nums1 = [1,2,3,6], nums2 = [2,3,4,5]
<strong>Output:</strong> 2
<strong>Explanation:</strong> There are two common elements in the array 2 and 3 out of which 2 is the smallest, so 2 is returned.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= nums1.length, nums2.length &lt;= 10<sup>5</sup></code></li>
	<li><code>1 &lt;= nums1[i], nums2[j] &lt;= 10<sup>9</sup></code></li>
	<li>Both <code>nums1</code> and <code>nums2</code> are sorted in <strong>non-decreasing</strong> order.</li>
</ul>

class Solution:
    def getCommon(self, nums1: List[int], nums2: List[int]) -> int:
        min_num1=min(nums1)
        max_num1 = max(nums1)
        min_num2 = min(nums2)
        max_num2= max(nums2)
        startv = 0
        endv = 0
        if min_num1<=min_num2 :
            startv = min_num2
        else:
            startv = min_num1

        if max_num1>=max_num2 :
            endv = max_num2
        else:
            endv = max_num1
        print(startv)
        print(endv)
        if startv>endv:
            return -1
        merged_list = []    

        merged_list.extend(list(set(nums1)))
        merged_list.extend(list(set(nums2)))
        merged_list.sort()
        print(merged_list)
        l = merged_list.index(startv)
        print(l)
        if l>0:
            for i in range(0, l):
                merged_list.pop(0)
        print(merged_list)
        r = merged_list.index(endv)
        print(r)
        if r<len(merged_list)-1:
            for i in reversed(range(len(merged_list), r+1)):
                merged_list.pop()
        print(merged_list)
        count = 0
        for i in range(0, len(merged_list)):
            if i!=0:
                if merged_list[i-1]==merged_list[i]:
                    return merged_list[i]

        return -1
        # for item in range(startv, endv+1):
        #     if nums1.count(item)>0 and nums2.count(item):
        #         return item
        #     i=0
        # minv_nums1 = min(nums1)
        # maxv_nums1 = max(nums1)
        # minv_nums2 = min(nums2)
        # maxv_nums2 = max(nums2)
        # if minv_nums1<minv_nums2 and maxv_nums1>maxv_nums2:
        # list_nums3=[]
        # list_nums1 = list(set(nums1))
        # list_nums2 = list(set(nums2))
        # list_nums3.extend(list_nums1.copy())
        # list_nums3.extend(list_nums2.copy())
        # # res2 = [x for x in list_nums1 + list_nums2 if x  in list_nums1 and x  in list_nums2]
        # # set([x for x in list_nums3 if list_nums3.count(x) > 1])
        # # res2 = nums1+nums2-list_nums3
        
        # res2 = []
        # print(res2)
        # if len(res2)>0:
        #     return min(res2)
        # else:
        #     return -1
        # # list_new = []
        # # min_num1=min(nums1)
        # # max_num1 = max(nums1)
        # # min_num2 = min(nums2)
        # # max_num2= max(nums2)
        # # startv = 0
        # # endv = 0
        # # if min_num1<=min_num2 :
        # #     startv = min_num2
        # # else:
        # #     startv = min_num1

        # # if max_num1>=max_num2 :
        # #     endv = max_num2
        # # else:
        # #     endv = max_num1
        # # print(startv)
        # # print(endv)
        # # print(len(nums1))
        # # print(len(nums2))
        # # # for item in range(startv, endv+1):
        # # #     # if nums1.count(item)>0 and nums2.count(item):
        # # #         # return item
        # # #     i=0
        # # return -1
407