摘要: problem维护一个集合,支持以下两种操作 1. 加入一个字符串s 2. 查询集合中是否存在字符串ssolution维护一个哈希表,判断字符串是否已出现过。codes#include#include#includeusing namespace std;c... 阅读全文
posted @ 2018-08-09 16:49 gwj1139177410 阅读(187) 评论(0) 推荐(0)
摘要: problem有n片雪花,每片有6个脚,每个脚有一个长度。两片雪花是一样的当且仅当每个脚的长度顺序都一样(顺逆时针和开始位置不管)求n片雪花中是否有一样的雪花。solution维护一个哈希表定义Hash(a1,a2,..a6) = (sum(a1..a6)+... 阅读全文
posted @ 2018-08-09 15:56 gwj1139177410 阅读(129) 评论(0) 推荐(0)
摘要: problem给定两个字符串s1,s2,求s1在s2中出现了多少次(可重叠)。len(s1) #include#includeusing namespace std;typedef long long LL;const int maxn = 1e6+10, ... 阅读全文
posted @ 2018-08-09 13:53 gwj1139177410 阅读(202) 评论(0) 推荐(0)
摘要: problem给一个字符串,长度不超过 1e6,有两种操作:在第 i 个字符的前面添加一个字符 ch查询第 k 个位置是什么字符操作的总数不超过 2000solution1、传统的数组所有数据在内存中是紧凑储存的,优点是定位快:O(1),缺点是修改慢:O(n... 阅读全文
posted @ 2018-08-09 13:03 gwj1139177410 阅读(306) 评论(0) 推荐(0)
选择