problem

925. Long Pressed Name

solution1:

class Solution {
public:
bool isLongPressedName(string name, string typed) {
int i=, m=name.size(), n=typed.size();
for(int j=; j<n; ++j)
{
if(i<m && name[i]==typed[j]) i++;
else if(!j && typed[j]!=typed[j-]) return false;
}
return i==m;
}
};

参考

1. Leetcode_easy_925. Long Pressed Name;

2. discuss;

3. cnblogs;

【Leetcode_easy】925. Long Pressed Name的更多相关文章

  1. 【leetcode】925.Long Pressed Name

    题目如下: Your friend is typing his name into a keyboard.  Sometimes, when typing a character c, the key ...

  2. 【LeetCode】925. Long Pressed Name 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 参考资料 日期 题目地址:https://leetc ...

  3. 【CodeForces】925 C.Big Secret 异或

    [题目]C.Big Secret [题意]给定数组b,求重排列b数组使其前缀异或和数组a单调递增.\(n \leq 10^5,1 \leq b_i \leq 2^{60}\). [算法]异或 为了拆位 ...

  4. 【Leetcode_easy】1021. Remove Outermost Parentheses

    problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完

  5. 【Leetcode_easy】1022. Sum of Root To Leaf Binary Numbers

    problem 1022. Sum of Root To Leaf Binary Numbers 参考 1. Leetcode_easy_1022. Sum of Root To Leaf Binar ...

  6. 【Leetcode_easy】1025. Divisor Game

    problem 1025. Divisor Game 参考 1. Leetcode_easy_1025. Divisor Game; 完

  7. 【Leetcode_easy】1029. Two City Scheduling

    problem 1029. Two City Scheduling 参考 1. Leetcode_easy_1029. Two City Scheduling; 完

  8. 【Leetcode_easy】1030. Matrix Cells in Distance Order

    problem 1030. Matrix Cells in Distance Order 参考 1. Leetcode_easy_1030. Matrix Cells in Distance Orde ...

  9. 【Leetcode_easy】1033. Moving Stones Until Consecutive

    problem 1033. Moving Stones Until Consecutive 参考 1. Leetcode_easy_1033. Moving Stones Until Consecut ...

随机推荐

  1. MySQL 索引原理以及慢查询优化

    本文以MySQL数据库为研究对象,讨论与数据库索引相关的一些话题.特别需要说明的是,MySQL支持诸多存储引擎,而各种存储引擎对索引的支持也各不相同,因此MySQL数据库支持多种索引类型,如BTree ...

  2. Vue模板语法(二)

    Vue基础模板语法 二 1. 样式绑定 1.1 class绑定      使用方式:v-bind:class="expression"       expression的类型:字符 ...

  3. 使用对象,面向对象创建div的方式

    <script> // //对象div的创建 // var div = document.createElement("div"); // document.body. ...

  4. linux学习7 Linux文件系统功能和作用详解

    一.终端 1.用户界面 GUI: GNome KDE CLI: bash,zsh,sh,csh,tcsh,ksh 2.远程连接 a.ssh协议. 查看系统是否监听于tcp协议的22号端口: ss  - ...

  5. YAML_18 ansible 判断和循环

    标准循环 模式一 - name: add several users user: name={{ item }} state=present groups=wheel with_items: - te ...

  6. Windows异常的分发处理流程

    根据异常来源,一般分硬件异常和软件异常,它们处理的流程大致一样,下面简单讲一下. 如果是硬件异常,CPU会根据中断类型号转而执行对应的中断处理程序.CPU会在IDT中查找对应的函数来处理,各个异常处理 ...

  7. C# 分割字符串 分隔符是字符串的情况

    string[] arr = System.Text.RegularExpressions.Regex.Split(str, "\r\n");

  8. 学习速率过大 or 过小

  9. Pytest权威教程16-经典xUnit风格的setup/teardown

    目录 经典xUnit风格的setup/teardown 模块级别setup/teardown 类级别setup/teardown 方法和函数级别setup/teardown 返回: Pytest权威教 ...

  10. 重写mybatis的字符串类型处理器

    1.简介 无论是 MyBatis 在预处理语句(PreparedStatement)中设置一个参数时,还是从结果集中取出一个值时, 都会用类型处理器将获取的值以合适的方式转换成 Java 类型. St ...