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. 学习Java的第一天

    登录http://www.oracle.com,下载JDK(J2SE)JDK 1.0,1.1,1.2,1.3,1.4 1.5 (JDK5.0) 支持注解.支持泛型 1.6(JDK6.0) Servel ...

  2. My SQL随记 002 登陆

    如何启动MySQL服务 Step1 我的电脑右键属性找到 控制面板 选择 系统和安全 Step2 管理工具中找到服务 Step3 找到你的MySQL启动服务 如何通过黑窗口登陆退出 MySQL Ste ...

  3. grep语法2

    grep 参数 -n  :显示行号-o  :只显示匹配的内容-q  :静默模式,没有任何输出,得用$?来判断执行成功没有,即有没有过滤到想要的内容 -l  :如果匹配成功,则只将文件名打印出来,失败则 ...

  4. SQLserver触发器实现A表insert到B表

    CREATE TABLE tab1(tab1_id varchar(11));CREATE TABLE tab2(tab2_id varchar(11)); 现在我们有两张表,要实现在A表里面inse ...

  5. Linux装agent

    解压Linux.zip  Linux的负载机链接:https://pan.baidu.com/s/1yrmsT3PYfuL9Wlh4FEYxaA 密码:s72n unzip Linux.zip chm ...

  6. CPU瓶颈分析工具

    性能指标: 一.CPU利用率. 1.用户CPU使用率:用户态CPU使用率(user)和低优先级用户态CPU使用率(nice). 2.系统CPU使用率:说明内核比较忙. 3.等待I/O的CPU使用率(i ...

  7. bash的工作特性(2)

    bash的工作特性之命令执行状态返回值和命令行展开所涉及的内容及其示例演示. 命令的执行结果状态 成功,失败 bash使用特殊变量$?保存最近一条命令的执行状态结果:echo$? 0:成功 1-255 ...

  8. Concordion test

    reference documents http://concordion.org/Example.html

  9. PythonStudy——算术运算符 Arithmetic operator

    # 减法 # 加法 print(10 + 20) print('abc' + 'def') print([1, 2, 3] + [4, 5, 6]) Output: 30  abcdef  [1, 2 ...

  10. ie 浏览器缓存问题

    Get请求在IE会存在缓存问题,最直接的办法  改成Post请求解决