leetcode448
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的更多相关文章
- 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 ...
- [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 ...
- 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 ...
- O(n)复杂度求没有出现的数字(leetcode448)
一个长度为N的数组,其中元素取值为1-N,求这个数组中没有出现的.1-N之间的数字. 要求无额外空间,O(n)时间复杂度. nums[i]=-1表示i数字已经出现过了 class Solution(o ...
- Leetcode448.Find All Numbers Disappeared in an Array找到所有数组中消失的数字
给定一个范围在 1 ≤ a[i] ≤ n ( n = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次. 找到所有在 [1, n] 范围之间没有出现在数组中的数字. 您能在不 ...
- LeetCode数组刷题——448、48、240、769
1.[LeetCode448]:448. 找到所有数组中消失的数字 题目分析: 1-n之间有重复的,有没出现的,有出现一次.使用hashmap,空间复杂度为O(n) 方法一:哈希表,但是空间复杂度超过 ...
随机推荐
- 关于maven环境变量的配置问题
开始使用“MAVEN_HOME”配置完环境变量后,在cmd中输入mvn -v提示不是内部命令,后直接在PATH 路径里面添加maven所在的位置+\bin,比如,maven的路径为E:\maven\a ...
- HTML和CSS标签常用命名规则
1.Images 存放一些网站常用的图片: 2.Css 存放一些CSS文件: 3.Flash 存放一些Flash文件: 4.PSD 存放一些PSD源文件: 5.Temp 存放所有临时图片和其它文件: ...
- git diff 与git format-patch 生成补丁包
git diff commit_id 会生成最后一次提交到目前修改过的内容补丁 git diff commit_id1 commit_id2 会生成两次提交之间修改过的内容补丁 git format- ...
- input[type='file']默认样式
<input type="file" name="" id="" value="" /> 当input的ty ...
- 在微信小程序中,如何实现下拉刷新(模拟刷新)
一.在app.json中启动刷新, 在Windows 中, 添加 "enablePullDownRefresh":"true" 二.在需要刷新的页面中写(若是 ...
- 工作中 sql 整理(一)
这篇文章记录关于SQL的内容,有些凌乱,是工作中点滴的积累,只能按照时间顺序,逐次记录. 一.update 关联更新 1.需求 Table A TableB A表中的主键和B表中的主键相关联,关联 ...
- 全志A33 lichee Linux内核原子操作(附实测代码)
开发平台 * 芯灵思SinlinxA33开发板 淘宝店铺: https://sinlinx.taobao.com/ 嵌入式linux 开发板交流 QQ:641395230 原子操作是指不会被线程调度机 ...
- C#软件开发实例.私人订制自己的屏幕截图工具(九)使用自己定义光标,QQ截图时的光标
版权声明:本文为 testcs_dn(微wx笑) 原创文章,非商用自由转载-保持署名-注明出处,谢谢. https://blog.csdn.net/testcs_dn/article/details/ ...
- Python Json & Pickle模块
用于序列化的两个模块 Json,用于字符串 和 python数据类型间进行转换 Pickle,用于python特有的类型 和 python的数据类型间进行转换 Json模块提供了四个功能:dumps. ...
- awk命令过滤tomcat的访日日志中IP地址
1. 命令如下 批量过滤日志文件,grep -v是要排除10网段开头的IP地址 sort会自动按ip排序 uniq -c去重并计数 sort -n 按数值从小到大排序 [root@linux-node ...