problem

705. Design HashSet

题意:

solution1:

class MyHashSet {
public:
/** Initialize your data structure here. */
MyHashSet() {
data.resize(, );
} void add(int key) {
data[key] = ;
} void remove(int key) {
data[key] = ;
} /** Returns true if this set contains the specified element */
bool contains(int key) {
//if(data[key]==1) return true;
//else return false;
return data[key]==;
}
vector<int> data;
}; /**
* Your MyHashSet object will be instantiated and called as such:
* MyHashSet* obj = new MyHashSet();
* obj->add(key);
* obj->remove(key);
* bool param_3 = obj->contains(key);
*/

solution2:

参考

1. Leetcode_easy_705. Design HashSet;

2. Grandyang;

最新文章

  1. python正则表达式re
  2. innodb 存储引擎特性
  3. rocksDB 安装问题简单介绍
  4. iOS - Mac OS X 终端命令
  5. Svn win7系统下状态图标不显示-转载
  6. git设计哲学
  7. Topcoder SRM 637 (Div.2)
  8. MFC界面更新实现方法
  9. Visual Studio发布项目到远程服务器的步骤
  10. Oracle EBS-SQL (BOM-17):检查8层BOM.sql
  11. [置顶] CopyU!v2插件合集 [2013年7月18日更新]
  12. sql常用语句汇总
  13. 标准IO库
  14. Linux-进程描述(5)之进程环境
  15. tomcat的常用配置方法
  16. 结对编程-四则运算生成程序-GUI界面
  17. HTTP/2部署使用
  18. .net core使用ef core操作mysql数据库
  19. gparted 不能起作用的时候,用fdisk
  20. Codeforces Round #367 (Div. 2) D. Vasiliy&#39;s Multiset(01字典树求最大异或值)

热门文章

  1. go常量的定义和枚举类型
  2. Soda Theme sublime 自定义编辑器主题
  3. Codeforces Round #555 (Div. 3) C1,C2【补题】
  4. 在mysql中用int类型存储IP
  5. Laravel 报 Nginx 502 : Bad Gateway 错误
  6. 洛谷 P1309 瑞士轮 题解
  7. plupload上传整个文件夹
  8. luogu 2934
  9. [转][c++11]我理解的右值引用、移动语义和完美转发
  10. OS创建页目录和页