当前位置:网站首页>[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)
边栏推荐
- 蚂蚁新村田头村变甜头村 让厦门灌口镇田头村变甜头村的特色农产品之一是
- Solve the problem of garbled files uploaded by Kirin v10
- One of the characteristic agricultural products that make Tiantou village, Guankou Town, Xiamen into a "sweet" village is
- 地宫取宝(记忆化深搜)
- 10-golang运算符
- How does MySQL store Emoji?
- 手把手教你实现一个深度学习框架...
- Restframework-simplejwt rewrite authentication mechanism
- SystemVerilog learning-09-interprocess synchronization, communication and virtual methods
- Teach you how to implement a deep learning framework
猜你喜欢
随机推荐
jdbc-连接池
【ManageEngine卓豪 】助力世界顶尖音乐学院--茱莉亚学院,提升终端安全
Restframework-simplejwt rewrite authentication mechanism
【ITSM】什么是ITSM,IT部门为什么需要ITSM
SystemVerilog learning-08-random constraints and thread control
【ManageEngine】如何实现网络自动化运维
jdbc 数据库操作
C# ManualResetEvent 类的理解
Projects and dependencies in ABP learning solutions
【ManageEngine卓豪】移动终端管理解决方案,助力中州航空产业数字化转型
【网络安全工具】USB控制软件有什么用
Ant new village is one of the special agricultural products that make Tiantou village in Guankou Town, Xiamen become Tiantou village
FPGA - 7 Series FPGA internal structure clocking-01-clock Architecture Overview
Save data in browser to local file
libpng12.so. 0: cannot open shared object file: no such file or directory
Recueillir des trésors dans le palais souterrain (recherche de mémoire profonde)
three.js小结
PLA不粘贴在床上:6个简单的解决方案
FPGA - clocking -02- clock wiring resources of internal structure of 7 Series FPGA
MongoDB:一、MongoDB是什么?MongoDB的优缺点






![Pit of kotlin bit operation (bytes[i] and 0xff error)](/img/2c/de0608c29d8af558f6f8dab4eb7fd8.png)
