public class Solution
{
public double FindMedianSortedArrays(int[] nums1, int[] nums2)
{
var nums = nums1.Concat(nums2).OrderBy(x => x).ToArray();
var len = nums.Length;
if (len % == )
{
return Convert.ToDouble(nums[len / ] + nums[len / - ]) / ;
}
else
{
return Convert.ToDouble(nums[len / ]);
}
}
}

leetcode4的更多相关文章

  1. leetcode-4. 寻找两个正序数组的中位数

    leetcode-4. 寻找两个正序数组的中位数. 给定两个大小为 m 和 n 的正序(从小到大)数组 nums1 和 nums2. 请你找出这两个正序数组的中位数,并且要求算法的时间复杂度为 O(l ...

  2. Leetcode4:Median of Two Sorted Arrays@Python

    There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two ...

  3. LeetCode4:Add Two Numbers

    题目: You are given two linked lists representing two non-negative numbers. The digits are stored in r ...

  4. LeetCode4 Median of Two Sorted Arrays

    题目: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the ...

  5. leetcode4 Valid Palindrome回文数

    Valid Palindrome回文数 whowhoha@outlook.com Question: Given a string, determine if it is a palindrome, ...

  6. LeetCode4. Median of Two Sorted Arrays---vector实现O(log(m+n)--- findkth

    这道题目和PAT上的1029是同一题.但是PAT1029用O(m+n)的时间复杂度(题解)就可以,这道题要求是O(log(m+n)). 这道题花费了我一个工作日的时间来思考.因为是log因而一直思考如 ...

  7. LeetCode-4. 两个排序数组的中位数(详解)

    链接:https://leetcode-cn.com/problems/median-of-two-sorted-arrays/description/ 有两个大小为 m 和 n 的排序数组 nums ...

  8. [Swift]LeetCode4. 两个排序数组的中位数 | Median of Two Sorted Arrays

    There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two ...

  9. leetcode4:两个排序数组的中位数

    给定两个大小为 m 和 n 的有序数组 nums1 和 nums2 . 请找出这两个有序数组的中位数.要求算法的时间复杂度为 O(log (m+n)) . 1.我的思路:直接用sort,时间复杂度应如 ...

随机推荐

  1. error ...项目路径 \node_modules\chromedriver: Command failed.

    当你拿到完整的vue项目代码,像 node_modules 整个文件夹不可能提交到svn或者github的, 所以怎么自己安装整个项目所需要的一些依赖呢, 前提是你全局安装了node,才能使用nom命 ...

  2. 使用POI读取xlsx文件,包含对excel中自定义时间格式的处理

    package poi; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundExcepti ...

  3. web.html

    在“Web页”节点下,展开WEB-INF节点,然后双击web.xml文件进行查看. web.xml文件包含Facelets应用程序所需的几个元素.使用NetBeans IDE创建应用程序时,将自动创建 ...

  4. h5 js判断是安卓还是ios设备,跳转到对应的下载地址

    /*ios和安卓跳转 js*/$(function(){ var u = navigator.userAgent; var ua = navigator.userAgent.toLowerCase() ...

  5. python学习之路04——列表和字典

    列表和字典 python中的可变数据类型有:列表和字典 不可变类型:数字,字符串,元组 今天先讲列表和字典 一.列表 1.概念: 变量:使用变量存储数据,但是,变量存储数据每次只能存储一个数据 问题: ...

  6. JavaScript 基础篇1

    JavaScript引用问题 1:<script>标签引用嵌入html页面中,在外部引用中是JavaScript文件时必须用src属性设置相应的文件的URL.2:在不使用defer和asy ...

  7. JVM垃圾回收算法解析

    JVM垃圾回收算法解析 标记-清除算法 该算法为最基础的算法.它分为标记和清除两个阶段,首先标记出需要回收的对象,在标记结束后,统一回收.该算法存在两个问题:一是效率问题,标记和清除过程效率都不太高, ...

  8. Windows 下 安装 laravel(一些小笔记)

    首先 安装完composer       下载地址    https://getcomposer.org/ 在  cmd  进入到  自己的项目访问目录 然后  输入命令:composer creat ...

  9. struct 和typedef struct

    1.typedef (1)typedef的使用 定义一种类型的别名,而不只是简单的宏替换(见陷阱一).用作同时声明指针型的多个对象 typedef char* PCHAR; // 一般用大写,为cha ...

  10. github与github网站push神器

    GitBook.Editor(全英文,无汉化) 链接: http://pan.baidu.com/s/1slIZ5jJ 密码: q9mw source tree (汉化中文) 本地需要安装git客户端 ...