Leetcode-925 Long Pressed Name(长按键入)

 1 class Solution
 2 {
 3     public://saeed ssaaedd
 4         bool isLongPressedName(string name, string typed)
 5         {
 6             int typedEnd = 0;
 7             for(int i = 0;i < name.size();i ++)
 8             {
 9                 while(typedEnd < typed.size() && name[i]!=typed[typedEnd])
10                     typedEnd ++;
11                     
12                 if(typedEnd >= typed.size())
13                     return false;
14                 
15                 typedEnd ++;
16             }
17             return true;
18         }
19 };

猜你喜欢

转载自www.cnblogs.com/Asurudo/p/9838407.html