1 public class Solution
 2     {
 3         public double FindMedianSortedArrays(int[] nums1, int[] nums2)
 4         {
 5             var nums = nums1.Concat(nums2).OrderBy(x => x).ToArray();
 6             var len = nums.Length;
 7             if (len % 2 == 0)
 8             {
 9                 return Convert.ToDouble(nums[len / 2] + nums[len / 2 - 1]) / 2;
10             }
11             else
12             {
13                 return Convert.ToDouble(nums[len / 2]);
14             }
15         }
16     }

 

posted on 2019-03-06 09:28  Sempron2800+  阅读(333)  评论(0编辑  收藏  举报