Skip to content

Commit

Permalink
Long Pressed Name
Browse files Browse the repository at this point in the history
  • Loading branch information
rinwf committed Oct 21, 2018
1 parent 5a7cf2a commit 315c724
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lc925. Long Pressed Name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Solution:
def isLongPressedName(self, name, typed):
"""
:type name: str
:type typed: str
:rtype: bool
"""
i = j = 0
length1, length2 = len(name), len(typed)
while i < length1 and j < length2:
while j < length2:
if name[i] == typed[j]:
i, j = i + 1, j + 1
break
else:
j += 1
return i == length1


name = "laidden"
typed = "laiden"
s = Solution()
print(s.isLongPressedName(name, typed))

0 comments on commit 315c724

Please sign in to comment.