MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / isLongPressedName

Method isLongPressedName

String/LongPressedName.py:45–67  ·  view source on GitHub ↗

:type name: str :type typed: str :rtype: bool

(self, name, typed)

Source from the content-addressed store, hash-verified

43"""
44class Solution(object):
45 def isLongPressedName(self, name, typed):
46 """
47 :type name: str
48 :type typed: str
49 :rtype: bool
50 """
51 x = 0
52 y = 0
53
54 x_length = len(name)
55 y_length = len(typed)
56
57 while x < x_length and y < y_length:
58
59 if typed[y] == name[x]:
60 y += 1
61 x += 1
62 else:
63 y += 1
64
65 if x == x_length:
66 return True
67 return False

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected