当前位置:网站首页>[leetcode] day91- duplicate elements exist
[leetcode] day91- duplicate elements exist
2022-07-01 06:20:00 【Upside down, it's a circle】
subject
217. There are duplicate elements 【 Simple 】
Answer key
class Solution {
public boolean containsDuplicate(int[] nums) {
Set<Integer>hashSet=new HashSet<>();
for(int i=0;i<nums.length;i++){
if(hashSet.contains(nums[i]))
return true;
hashSet.add(nums[i]);
}
return false;
}
}
Time complexity : O ( n ) O(n) O(n)
Spatial complexity : O ( n ) O(n) O(n)
边栏推荐
- pycharm 配置jupyter
- Multi label lsml for essay learning records
- three.js小结
- JMM详解
- [file system] how to run squashfs on UBI
- SOE空间分析服务器 MySQL以及PostGres的地理空间库PostGIS防注入攻击
- Flink实战--多流合并
- Understanding of C manualresetevent class
- Talking from mlperf: how to lead the next wave of AI accelerator
- UOW of dev XPO comparison
猜你喜欢
【网络安全工具】USB控制软件有什么用
Make Tiantou village sweet. Is Xianjing taro or cabbage the characteristic agricultural product of Tiantou Village
Top 10 Free 3D modeling software for beginners in 2022
Talking from mlperf: how to lead the next wave of AI accelerator
Index method and random forest to realize the information of surface water body in wet season in Shandong Province
【企业数据安全】升级备份策略 保障企业数据安全
Distributed lock implementation
Database problems, how to optimize Oracle SQL query statements faster and more efficient
Pit of kotlin bit operation (bytes[i] and 0xff error)
The row and column numbers of each pixel of multi-source grid data in the same area are the same, that is, the number of rows and columns are the same, and the pixel size is the same
随机推荐
Index method and random forest to realize the information of surface water body in wet season in Shandong Province
【ManageEngine卓豪】助力黄石爱康医院实现智能批量化网络设备配置管理
three. JS summary
To sort out the anomaly detection methods, just read this article!
SOE spatial analysis server MySQL and PostGIS geospatial database of Postgres anti injection attack
DHT11 温湿度传感器
HCM Beginner (III) - quickly enter pa70 and pa71 to browse employee information PA10
3D打印机穿线:5种简单的解决方案
Elements of database ER diagram
Recueillir des trésors dans le palais souterrain (recherche de mémoire profonde)
Pit of kotlin bit operation (bytes[i] and 0xff error)
Factorial divisor (unique decomposition theorem)
HDU - 1501 zipper (memory deep search)
[postgraduate entrance examination advanced mathematics Wu Zhongxiang +880 version for personal use] advanced mathematics Chapter II Basic Stage mind map
Ant new village is one of the special agricultural products that make Tiantou village in Guankou Town, Xiamen become Tiantou village
Infinite horizontal marble game
3D printer threading: five simple solutions
HCM Beginner (I) - Introduction
Dongle data collection
【ManageEngine卓豪 】助力世界顶尖音乐学院--茱莉亚学院,提升终端安全