Skip to content

Commit

Permalink
easy 925
Browse files Browse the repository at this point in the history
  • Loading branch information
samjazaaa committed Sep 26, 2022
1 parent 673f918 commit 7cd3542
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/easy/925-long-pressed-name/name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

class Solution:
def isLongPressedName(self, name: str, typed: str) -> bool:

if (len(name) > len(typed)):
return False

j = 0
i = 0
while (j < len(typed)):
if (i < len(name) and typed[j] == name[i]):
j += 1
i += 1
continue
if (i > 0 and typed[j] == name[i-1]):
j += 1
continue
return False

if i < len(name):
return False
else:
return True

0 comments on commit 7cd3542

Please sign in to comment.