Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a96ce7f

Browse files
Create 1291.py
1 parent 41ac4e1 commit a96ce7f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎1001-1500/1291.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def sequentialDigits(self, low: int, high: int) -> List[int]:
3+
x = "123456789"
4+
ans = []
5+
6+
for i in range(len(x)):
7+
for j in range(i + 1, len(x) + 1):
8+
curr = int(x[i:j])
9+
if low <= curr <= high:
10+
ans.append(curr)
11+
return sorted(ans)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /