Files
LeetCode/0004-median-of-two-sorted-arrays/solution.py
Simon Oberzier 3ebdf3d3b9 Problem 3 and 4
2026-01-08 22:45:44 +01:00

5 lines
265 B
Python

class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
nums1 = sorted(nums1 + nums2)
length = len(nums1)
return nums1[length//2] if length % 2 == 1 else float(sum(nums1[length//2-1:length//2+1]))/2