809. Expressive Words
2024-09-03 16:02:41
https://leetcode.com/problems/expressive-words/description/
class Solution {
public:
int expressiveWords(string S, vector<string>& words) {
int res = ;
for (const auto& w : words) {
if (check(S, w))
res++;
}
return res;
}
bool check(const string& s, const string& w) {
int i = , j = , m = s.length(), n = w.length();
while (i < m && j < n) {
if (s[i] != w[j]) return false;
int ii = , jj = ;
while (++i < m && s[i] == s[i-]) ii++;
while (++j < n && w[j] == w[j-]) jj++;
if (ii < jj || ii < && ii != jj) return false;
}
return i == m && j == n;
}
};
最新文章
- [bzoj1269][AHOI2006文本编辑器editor] (splay模版题 or pb_ds [rope]大法)
- ZeroMQ接口函数之 :zmq_version – 返回ZMQ链接库的版本
- p7-p8面试经验总结--拿到offer
- SQL Server优化器特性-隐式谓词
- Gershgorin圆盘定理
- SELinux的故障排除一例
- ###C中的extern-static-const关键词
- 我也要这样写define、、
- MySQL中横表和竖表相互转换
- uploadPreview上传图片前预览图片
- PHP use闭包函数
- Ubuntu 16.04 标题栏实时显示上下行网速、CPU及内存使用率
- How to use jQuery countdown plugin
- cocos2d-x-3.1 win32程序-初识源代码(coco2d-x 学习笔记二)
- wepy - 与原生有什么不同($pages,$interceptors)
- jQuery实现页面关键词高亮
- Swift coreAnimation 加计时器写的游戏《飞机大战》
- uva-10596-欧拉回路
- spring --解析自定义注解SpringAOP(配合@Aspect)
- php curl get post 方法的封装
热门文章
- 2009年3月新浪PHP面试题及答案(一)
- myBatis执行测试批量删除,出现测试类正常显示,但数据库数据没变
- 【踩坑】vue 无法让后台保存 session
- yum 和 rpm安装mysql彻底删除
- ps使用
- python 函数学习之sys.argv[1]
- python 学习之FAQ:文档内容写入报错
- 介绍一款渗透神器——Burp Suite
- 利用binlog2sql解析mysqlbinlog row行日志
- help.hybris.com和help.sap.com网站的搜索实现