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协议规范了通 ...
随机推荐
- 1.- Netty设计理念-异步和事件驱动
0. 关键点 a). 非阻塞网络调用,异步方法立即返回 b). 选择器(Selector)使得单一线程就可监控很多连接上的事件. <dependency> <groupId>i ...
- pat1069. The Black Hole of Numbers (20)
1069. The Black Hole of Numbers (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, ...
- FFmpeg编译i386 OSX 脚本
话不多说, 直接上脚本 #!/bin/sh # directories PLATFORM="OSX" # FFmpeg脚本目录 SOURCE="ffmpeg-2.8.7& ...
- SpringBoot | 第五章:多环境配置
前言 写上一篇看英文资料,耗费了心力呀,这章,相对来说简单点.也比较熟悉,但是这很实用.不扯了,开始~ 多环境配置 maven的多环境配置 springboot多环境配置 总结 老生常谈 多环境配置 ...
- JSONP 回调给全局变量赋值失败解决
;//回调结束标志位var 临时全局变量;var 需要接收的全局变量: function getDate(){ flag = 0; //回调 inviteService.getActivityDeta ...
- Unity C# 脚本的单例
今天学习了一个比较不错的单例模式 public class UnitySigleton <T>: MonoBehaviour where T:class { public static T ...
- php允许被跨域ajax请求
只要在被请求端,加一句: header('Access-Control-Allow-Origin: *');
- WPF使用Aspose.Words导出Word文档
一.创建Word文档模板 分析需要导出的word文档,将固定的内容和由程序生成的内容分开; 创建一个word(例如:Template.doc)文档,将固定的内容按照一定的格式写入当前文档中; 打开Te ...
- Retrofit 2.0:有史以来最大的改进
因为其简单与出色的性能,Retrofit 是安卓上最流行的HTTP Client库之一. 不过它的缺点是在Retrofit 1.x中没有直接取消正在进行中任务的方法.如果你想做这件事必须手动杀死,而这 ...
- meterpreter > migrate 1548
1548 1500 explorer.exe x86 0 LIXIULI-VCS86VR\test C:\WINDOWS\Explorer.EXE 19 ...