2634. Minimum Common Value
My accepted Python solution to LeetCode problem 2634, Minimum Common Value, running in 11ms.
- Difficulty: Easy
- Python
- Runtime 11ms
- Memory 33MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 11ms, memory 33MB, accepted 2026-01-01.
class Solution:
def getCommon(self, nums1: List[int], nums2: List[int]) -> int:
i, j = 0, 0
while i < len(nums1) and j < len(nums2):
if nums1[i] == nums2[j]:
return nums1[i]
elif nums1[i] < nums2[j]:
i += 1
else:
j += 1
return -1