博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[LeetCode] Contains Duplicate
阅读量:7299 次
发布时间:2019-06-30

本文共 452 字,大约阅读时间需要 1 分钟。

A classic problem of hash set. The unordered_set of C++ is very suitable for this problem.

The code is as follows and it should be quite self-explanatory.

1     bool containsDuplicate(vector
& nums) {2 unordered_set
st;3 for (int i = 0; i < nums.size(); i++) {4 if (st.find(nums[i]) != st.end())5 return true;6 st.insert(nums[i]);7 }8 return false;9 }

转载地址:http://kdsnm.baihongyu.com/

你可能感兴趣的文章
我所理解的技术领导力
查看>>
浪潮-异构虚拟化存储研究
查看>>
浅析MySQL中exists与in的使用
查看>>
https ddos检测——研究现状
查看>>
Go 语言机制之逃逸分析
查看>>
清理mac的硬盘空间,清理Xcode,清除“其他”
查看>>
scrapy学习笔记(三):使用item与pipeline保存数据
查看>>
Linux-shell脚本-mysql一键安装
查看>>
js进阶---12-12、jquery事件委托怎么使用
查看>>
Caffe、TensorFlow、MXnet三个开源库对比+主流分类模型对比
查看>>
Python基础案例教程
查看>>
swfit:运算符重载 Operator Methods
查看>>
彻底清除挖矿程序
查看>>
Android View的生命周期
查看>>
使用Mesos和Marathon管理Docker集群
查看>>
mybatis中sql标签、where标签、foreach标签用法
查看>>
docker 安装kafka
查看>>
ora-01033:oracle initialization or shutdown in progress 解决方法
查看>>
解决 winform打开网页 和WebBrowser打开链接360误报拦截的问题
查看>>
PXC 57 二进制安装
查看>>