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)

模拟

相关推荐
memcpy02 分钟前
LeetCode 1456. 定长子串中元音的最大数目【定长滑窗模板题】中等
算法·leetcode·职场和发展
玛丽莲茼蒿20 分钟前
LeetCode hot100【相交链表】【简单】
算法·leetcode·职场和发展
wen__xvn21 分钟前
力扣模拟题刷题
算法·leetcode
不要秃头的小孩24 分钟前
力扣刷题——111.二叉树的最小深度
数据结构·python·算法·leetcode
We་ct1 小时前
LeetCode 35. 搜索插入位置:二分查找的经典应用
前端·算法·leetcode·typescript·个人开发
Navigator_Z2 小时前
LeetCode //C - 990. Satisfiability of Equality Equations
c语言·算法·leetcode
lightqjx3 小时前
【算法】前缀和
c++·算法·leetcode·前缀和
窝子面3 小时前
LeetCode练题三:链表
算法·leetcode·链表
y = xⁿ4 小时前
【LeetCodehot100】T108:将有序数组转换为二叉搜索树 T98:验证搜索二叉树
数据结构·算法·leetcode
hanlin034 小时前
刷题笔记:力扣第17题-电话号码的字母组合
笔记·算法·leetcode