1.题目:https://leetcode-cn.com/problems/long-pressed-name/
2.思路
(1)i,j分别指向name和typed,遍历时如果name[i]==typed[j] 则i++,j++;否则判断typed[j]==typed[j-1] 如果为假则返回false,否则 为true;
3.代码
(1)i,j分别指向name和typed,遍历时如果name[i]==typed[j] 则i++,j++;否则判断typed[j]==typed[j-1] 如果为假则返回false,否则 为true;
下一篇:844. 比较含退格的字符串
使用板子上的用户自定义按键控制LED亮灭
你的朋友正在使用键盘输入他的名字 name。偶尔,在键入字符 c 时,按键可能会
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M