public class Solution {
public IList<int> FindDisappearedNumbers(int[] nums) {
Dictionary<int, int> dic = new Dictionary<int, int>();
for (int i = ; i <= nums.Length; i++)
{
dic.Add(i, );
} for (int i = ; i < nums.Length; i++)
{
dic[nums[i]]++;
} var list = new List<int>();
for (int i = ; i <= nums.Length; i++)
{
if (dic[i] == )
{
list.Add(i);
}
} return list;
}
}

https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/#/description

leetcode448的更多相关文章

  1. LeetCode-448. Find All Numbers Disappeared in an Array C#

    Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and ot ...

  2. [Swift]LeetCode448. 找到所有数组中消失的数字 | Find All Numbers Disappeared in an Array

    Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and ot ...

  3. Leetcode-448. Find All Numbers Disappeared in an Array(solve without extra space easy)

    Given an array of integers where 1 ≤ a[i] ≤ n (n= size of array), some elements appear twice and oth ...

  4. O(n)复杂度求没有出现的数字(leetcode448)

    一个长度为N的数组,其中元素取值为1-N,求这个数组中没有出现的.1-N之间的数字. 要求无额外空间,O(n)时间复杂度. nums[i]=-1表示i数字已经出现过了 class Solution(o ...

  5. Leetcode448.Find All Numbers Disappeared in an Array找到所有数组中消失的数字

    给定一个范围在  1 ≤ a[i] ≤ n ( n = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次. 找到所有在 [1, n] 范围之间没有出现在数组中的数字. 您能在不 ...

  6. LeetCode数组刷题——448、48、240、769

    1.[LeetCode448]:448. 找到所有数组中消失的数字 题目分析: 1-n之间有重复的,有没出现的,有出现一次.使用hashmap,空间复杂度为O(n) 方法一:哈希表,但是空间复杂度超过 ...

随机推荐

  1. javascript 统计字符串中每个字符出现的次数

    var str = "abdcadfasfdbadfafdasdfasyweroweurowqrewqrwqrebwqrewqrejwq;;"; // console.log(nu ...

  2. 外网如何访问web项目holer实现篇

    外网访问WEB 内网主机上安装了WEB服务器,只能在局域网内访问,怎样从公网也能访问本地WEB应用? 本文将介绍使用holer实现的具体步骤. 1. 准备工作 1.1 安装Java 1.7及以上版本 ...

  3. MacOs 安装cordova报无权访问题解决方案

    在MacOS安装cordova后,执行cordova -v报错: Error: EACCES: permission denied, open '/Users/jianuonuo/.config/co ...

  4. C语言gcc处理过程

    gcc编译C文件一共四步,预处理(Preprocess),编译(Compilation),汇编(Assembly)和链接(Linking) 1. 预处理(Preprocess) 预处理是预处理中会展开 ...

  5. PHP涉及的所有英文单词

    PHP涉及的所有英文单词拦路虎 PHP再火,也会让一部同学心生畏惧,因为看到编辑器中那一串串英文单词,担心自己英文不好,从而对能学会PHP的决心产生动摇.其实大可不必,英文在学习PHP过程中真的连级别 ...

  6. C语言如何在可变参数函数中使用printf?

    我要将printf外面再包上一层:void fun(const char* fmt,...) {........printf(fmt,...);........}这种函数怎么写? 对比下printf与 ...

  7. 让MySQL数据库跑的更快的7个优化建议!

    随着容量和负载的增加,MySQL 的性能会日趋缓慢.这里有七点建议能够保证 MySQL 的平稳运行. 性能是我们衡量应用的一种方式,而应用性能的一项指标就是用户体验,也就是平时我们常说的:“用户需要等 ...

  8. ubuntu16.04x下搜狗输入法无法输入中文

    使用如下命令: cd ~/,config find . -name sogou* 找到sogou-qimpanel ,sudo rm -r ./sogou-qimpanel删除 find . -nam ...

  9. Python全栈之路----函数----返回值

    函数外部的代码想要获取函数的执行结果,就可以在函数里用return语句,把结果返回. def stu_register(name,age,course='PY',country='CN'): prin ...

  10. Oracle使用笔记(二)

    一.表空间 1.创建表空间 create tablespace db_test --表空间名 datafile 'D:\oracle\product\11.2.0\dbhome_1\oradata\o ...