1291. Sequential Digits

1291. Sequential Digits

python 复制代码
class Solution:
    def sequentialDigits(self, low: int, high: int) -> List[int]:
        ans=[]
        for i in range(1,10):
            num=i
            nt_digit=i+1
            while num<high and nt_digit<=9:
                num=num*10+nt_digit
                if low<=num and num<=high:
                    ans.append(num)
                nt_digit+=1
        return sorted(ans)

模拟

相关推荐
Asmalin7 小时前
【代码随想录day 35】 力扣 01背包问题 一维
算法·leetcode·职场和发展
剪一朵云爱着7 小时前
力扣2779. 数组的最大美丽值
算法·leetcode·排序算法
tao3556678 小时前
【Python刷力扣hot100】283. Move Zeroes
开发语言·python·leetcode
未知陨落9 小时前
LeetCode:98.颜色分类
算法·leetcode
Haooog12 小时前
98.验证二叉搜索树(二叉树算法题)
java·数据结构·算法·leetcode·二叉树
Young_Zn_Cu14 小时前
LeetCode刷题记录(持续更新中)
算法·leetcode
天选之女wow14 小时前
【代码随想录算法训练营——Day31】贪心算法——56.合并区间、738.单调递增的数字、968.监控二叉树
算法·leetcode·贪心算法
Miraitowa_cheems17 小时前
LeetCode算法日记 - Day 64: 岛屿的最大面积、被围绕的区域
java·算法·leetcode·决策树·职场和发展·深度优先·推荐算法
_不会dp不改名_18 小时前
leetcode_1382 将二叉搜索树变平衡树
算法·leetcode·职场和发展
Q741_14720 小时前
C++ 位运算 高频面试考点 力扣 面试题 17.19. 消失的两个数字 题解 每日一题
c++·算法·leetcode·面试·位运算