1
# Runtime: 41 ms (Top 43.2%) | Memory: 16.29 MB (Top 65.6%)
2

3

4
class Solution:
5
def sequentialDigits(self, low: int, high: int) -> List[int]:
6
l = len(str(low))
7
h = len(str(high))
8
ans = []
9
for i in range(l, h + 1):
10
for j in range(1, 11 - i):
11
t = str(j)
12
for k in range(i - 1):
13
t += str(int(t[-1]) + 1)
14
if int(t) <= high and int(t) >= low:
15
ans.append(int(t))
16
ans.sort()
17
return ans

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0