摘要: 比较简单的一个题,但是浪费了很多时间,主要是因为刚开始的思路有一点漏洞。 Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Exa 阅读全文
posted @ 2020-02-09 22:16 强威 阅读(169) 评论(0) 推荐(0) 编辑
摘要: C++实现trid class TrieNode{ public: TrieNode():End(false), R(26){ links.resize(R); } void setEnd(){ End = true; } bool isEnd(){ return End; } bool conta 阅读全文
posted @ 2020-02-09 14:36 强威 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 单调队列分为递增队列和递减队列,一般用来求某个固定长度(例如:滑动窗口的最值)序列中的最大/最小值。 对于递增队列,队首元素就是最小值。 对于递减队列,队首元素就是最大值。 1.递增队列(队列首尾最小值) if(q.empty()) q.push_back(A[i]); else if(q.back 阅读全文
posted @ 2020-02-09 13:08 强威 阅读(300) 评论(0) 推荐(0) 编辑