leetcode 925 长按键入
LeetCode 按键
2023-09-27 14:29:24 时间
长按键入
class Solution {
public:
bool isLongPressedName(string name, string typed) {
int indnx = 0;
if(name[0] != typed[0]) return false;
for(int i=0 ; i<typed.size() ;i++)
{
if(typed[i] == name[indnx]) indnx++;
else if(typed[i] != name[indnx] && typed[i] != name[indnx-1]) return false;
}
if(indnx == name.size()) return true;
else return false;
}
};
相关文章
- 【LeetCode】排序链表 [M](排序)
- 【LeetCode】超级洗衣机 [H](贪心)
- 最小 XOR leetcode第 313 场周赛 第三题
- LeetCode_差分数组_中等_1109.航班预订统计
- LeetCode_回溯_中等_77.组合
- LeetCode·34.在排序数组中查询元素的第一个和最后一个位置·二分查找
- [LeetCode] 849. Maximize Distance to Closest Person 最大化最近人的距离
- [LeetCode] 628. Maximum Product of Three Numbers 三个数字的最大乘积
- [LeetCode] 325. Maximum Size Subarray Sum Equals k 和等于k的最长子数组
- [LeetCode] 98. Validate Binary Search Tree 验证二叉搜索树
- [LeetCode] 712. Minimum ASCII Delete Sum for Two Strings 两个字符串的最小ASCII删除和
- [LeetCode] 238. Product of Array Except Self 除本身之外的数组之积