五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Leetcode 2540. Minimum Common Value

2023-01-28 16:28 作者:您是打尖兒還是住店呢  | 我要投稿

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: 2Explanation: 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: 2Explanation: 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.

Accepted

21,559

Submissions

39,937

因為2個數(shù)組是已經(jīng)排好序的,所以我們不需要去hashmap或者set去處理,只要從頭開始去遍歷即可的;

Easy題目;

Runtime:?2 ms, faster than?86.18%?of?Java?online submissions for?Minimum Common Value.

Memory Usage:?72.9 MB, less than?61.45%?of?Java?online submissions for?Minimum Common Value.


Leetcode 2540. Minimum Common Value的評論 (共 條)

分享到微博請遵守國家法律
吉安县| 行唐县| 盖州市| 司法| 大冶市| 余干县| 扬州市| 沧州市| 印江| 渭南市| 甘孜县| 炉霍县| 天峻县| 广南县| 东宁县| 灵石县| 双桥区| 论坛| 盐城市| 汤阴县| 泸溪县| 思茅市| 右玉县| 寿光市| 宁蒗| 宁强县| 涡阳县| 福鼎市| 洮南市| 佳木斯市| 临潭县| 永平县| 延庆县| 永善县| 普安县| 隆安县| 永丰县| 寻乌县| 类乌齐县| 玉门市| 佛学|