Title: #2540 - Minimum Common Value - LeetCode JavaScript Solutions
Open Graph Title: #2540 - Minimum Common Value - LeetCode JavaScript Solutions
X Title: #2540 - Minimum Common Value - LeetCode JavaScript Solutions
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 c...
Open Graph 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 c...
X 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 c...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/minimum-common-value
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/minimum-common-value","name":"#2540 - Minimum Common Value - LeetCode JavaScript Solutions","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 c...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {number[]} nums1\n * @param {number[]} nums2\n * @return {number}\n */\nvar getCommon = function(nums1, nums2) {\n let i = 0;\n let j = 0;\n\n while (i < nums1.length && j < nums2.length) {\n if (nums1[i] === nums2[j]) return nums1[i];\n if (nums1[i] < nums2[j]) i++;\n else j++;\n }\n\n return -1;\n};","keywords":"LeetCode 2540, #2540 - Minimum Common Value, Easy, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}
| author | LeetCodeJavascript.com |
| og:type | article |
| og:image | https://leetcodejavascript.com/og-image.jpg |
| og:site_name | LeetCode JavaScript Solutions |
| twitter:card | summary_large_image |
| twitter:url | https://leetcodejavascript.com/solutions/minimum-common-value |
| twitter:image | https://leetcodejavascript.com/og-image.jpg |
| twitter:creator | @joshcrozier |
| theme-color | #1f2937 |
Links:
| LeetCodeJavascript.com | https://leetcodejavascript.com/ |
| Star on GitHub | https://github.com/JoshCrozier/leetcode-javascript |
| Back to all solutions | https://leetcodejavascript.com |
| View on LeetCode | https://leetcode.com/problems/minimum-common-value/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/2540-minimum-common-value.js |
| Array | https://leetcodejavascript.com/tags/array |
| Hash Table | https://leetcodejavascript.com/tags/hash-table |
| Binary Search | https://leetcodejavascript.com/tags/binary-search |
| Two Pointers | https://leetcodejavascript.com/tags/two-pointers |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width, initial-scale=1.0
Robots: index, follow