809. Expressive Words
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;
}
};
809. Expressive Words的更多相关文章
- 【LeetCode】809. Expressive Words 解题报告(Python)
[LeetCode]809. Expressive Words 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http ...
- leetcode笔记(五)809. Expressive Words
题目描述 Sometimes people repeat letters to represent extra feeling, such as "hello" -> &qu ...
- [LC] 809. Expressive Words
Example: Input: S = "heeellooo" words = ["hello", "hi", "helo&quo ...
- leetcode 学习心得 (4)
645. Set Mismatch The set S originally contains numbers from 1 to n. But unfortunately, due to the d ...
- All LeetCode Questions List 题目汇总
All LeetCode Questions List(Part of Answers, still updating) 题目汇总及部分答案(持续更新中) Leetcode problems clas ...
- Windows 10 L2TP 809错误
今天不知道为什么,一直工作正常的L2TP不能连接了.我用的是Surface Pro 3,Windows 10 专业版,操作系统一直保持自动更新,而且最近也没有安装什么软件.点击连接后,等一段时间就报8 ...
- NYOJ题目809摸底
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtEAAAI4CAIAAAAj4CIaAAAgAElEQVR4nO3drXLjTLeG4X0S4TmQYB
- 如何使用 Zend Expressive 建立 NASA 图片库?
在本文中,我们将借助 NASA 天文图库 API,使用 Zend Expressive 建立图片库.最后的结果将显示在 AstroSplash 网站,该网站是为了文本特意搭建的.本文系 OneAPM ...
- 轨迹系列——Socket总结及实现基于TCP或UDP的809协议方法
文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/ 1.背景 在上一篇博客中我详细介绍了809协议的内容.809协议规范了通 ...
随机推荐
- properties文件 , properties类, 的作用
"properties文件",是java所支持的配置文件类型.java中的properties文件是一种配置文件,主要用于表达配置信息,文件类型为*.properties,格式为文 ...
- Day2下午
虽然成绩不太好,但有点进入状态了.期望200 实际160,忘记加判断了. T1 洗澡[问题描述]你是能看到第一题的friends 呢.——hja洗澡的地方,有一段括号序列,将一个括号修改一次需要1的代 ...
- 判断dataset表中是否存在 某列
DataSet ds ; ds.Tables[0].Columns.Contains("a") 同样适用于 datarow dr ; dr.Table.Columns.Contai ...
- 斐波那契数列【java实现】
java 实现斐波那契数列 以下是Java代码实现(递归与递推两种方式): import java.util.Scanner; /** * Fibonacci * * @author tongqian ...
- jQuery读取和设定KindEditor值的方法
转载自:https://www.jb51.net/article/43595.htm 侵删 jQuery读取和设定KindEditor值的方法 更新时间:2013年11月22日 09:03:56 ...
- JSPt的Base标签
<base href="${pageContext.request.contextPath}/"/> 注意:base标签得到的内容是: /projectName/ 这种 ...
- window mysql5.7 zip 安装
第一步 ? 1 2 3 4 5 6 7 8 9 10 11 12 my-default.ini 添加配置: #绑定IPv4和3306端 bind-address = 127.0.0.1 port = ...
- 一个容易被忽视的css选择器
之前学的的迷糊了,也不知道什么会什么不会了,跑去面试了.别人列出一堆css选择器,本以为选择器没啥的,结果到那个多类选择器翻车了,.a.b选择同时含a,b类名的,很尴尬所以回来仔细整理了一下.目前根据 ...
- 【转】This Android SDK requires Android Developer Toolkit version 20.0.0 or above
本人最近在操作更新ANDROID SDK时出现类似于题目中的错误,是一启动ECLIPSE时.但是,我现在只是想恢复到原先的开发环境.于是找到本文,方法有效!!! windows 下面安装Android ...
- centos7.3.1611安装及初始配置
安装前规划: 主机名称 网络配置 分区配置 分区配置 自定义分区,标准分区 /boot 200M (可选) swap 内存1.5倍到2倍(不大于8G) / 根分区(100G到200G) 其余的备用(数 ...