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. css 文本超出范围显示省略号

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. ItelliJ idea tomcat 配置

    用ItelliJ idea 开发javaWeb. 1. Idea 安装Tomcat 打开Idea,选择设置,并在设置中左边框中选择 Application Servers 点击中间空白框上面的 ’+‘ ...

  3. 磁盘操作系统 cmd命令

    DOS CMD :磁盘操作系统 不区分大小写 **cd \ 根目录 cls 清空屏幕 dir 显示目录 d: 进入D盘 cd 进入目录命令 dir 查看当前目录的文件与目录 del 删除文件 del ...

  4. java-ArrayList中去重复字符串或重复对象、LinkedList集合、泛型、增强for、静态导入、可变参数、asList()方法、集合嵌套

    1.去除ArrayList中重复字符串元素方式 * A:案例演示 * 需求:ArrayList去除集合中字符串的重复值(字符串的内容相同) * 思路:创建新集合方式 /** * A:案例演示 * 需求 ...

  5. solr 学习笔记(一)--搜索引擎简介

    一 搜索引擎是什么一套可对大量结构化.半结构化数据.非结构化文本类数据进行实时搜索的专门软件最早应用于信息检索领域,经谷歌.百度等公司推出网页搜索而为大众广知.后又被各大电商网站采用来做网站的商品搜索 ...

  6. angular 使用window事件

    1. 使用host   2. 使用HostListener 推荐使用第二种方式. 不推荐下面的方法,虽然也能进行window事件的绑定,但组件销毁后,window事件任然保留,即使手动在组件的ngOn ...

  7. Ansible 快速部署 Zabbix 4

    阅读本文章需要具有Ansible.Zabbix基础.本次教程基于如下环境: CentOS 7.x Zabbix 4.0 Ansible 2.5 服务器初始化 关闭防火墙.selinux,添加epel常 ...

  8. (转)解决OSX上面PHP curl SSLRead()

    原创 2016年05月19日 19:39:04 标签: php / curl / osx 830 这个问题的原因是因为OSX curl默认使用 SecureTransport 而不是OpenSSL. ...

  9. Beautiful Soup库基础用法(爬虫)

    初识Beautiful Soup 官方文档:https://www.crummy.com/software/BeautifulSoup/bs4/doc/# 中文文档:https://www.crumm ...

  10. __slots__用法

    class Test(object): __slots__ = ("name","age") t = Test() t.name = "老王" ...