Guest User

Untitled

a guest
Jan 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. class Solution(object):
  2. def findMedianSortedArrays(self, nums1, nums2):
  3. """
  4. :type nums1: List[int]
  5. :type nums2: List[int]
  6. :rtype: float
  7. """
  8. nums3 = sorted (nums1 + nums2)
  9. numsEls =len(nums3)
  10.  
  11. if numsEls % 2 == 0:
  12. Left, Right = int(numsEls/2)-1 , int (numsEls/2)
  13.  
  14. return (float (nums3[Left]+ nums3[Right])/2)
  15. else:
  16. return nums3[int(numsEls/2)]
Add Comment
Please, Sign In to add comment