3324. Find the Sequence of Strings Appeared on the Screen
Read the full problem statement on LeetCode.
Difficulty: medium Acceptance: 79% Topics: String, Simulation
View full problem on LeetCode Reading material
Reference solution (spoiler · python)
# Time: O(n^2)
# Space: O(1)
# string
class Solution(object):
def stringSequence(self, target):
"""
:type target: str
:rtype: List[str]
"""
return [target[:i]+chr(x) for i in xrange(len(target)) for x in xrange(ord('a'), ord(target[i])+1)]
Solution from kamyu104/LeetCode-Solutions · MIT
Similar questions