Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save astery/c2ce16c819cdc280aa9d04c164f282a9 to your computer and use it in GitHub Desktop.
Save astery/c2ce16c819cdc280aa9d04c164f282a9 to your computer and use it in GitHub Desktop.
class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
nums = nums1 + nums2
nums = sorted(nums)
total = len(nums)
if total % 2 == 0:
return (nums[total/2-1] + nums[total/2]) / 2.0
else:
return nums[total/2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment