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)

模拟

相关推荐
杰九4 小时前
【算法题】46. 全排列-力扣(LeetCode)
算法·leetcode·深度优先·剪枝
manba_4 小时前
leetcode-560. 和为 K 的子数组
数据结构·算法·leetcode
liuyang-neu4 小时前
力扣 11.盛最多水的容器
算法·leetcode·职场和发展
忍界英雄4 小时前
LeetCode:2398. 预算内的最多机器人数目 双指针+单调队列,时间复杂度O(n)
算法·leetcode·机器人
Tisfy4 小时前
LeetCode 2398.预算内的最多机器人数目:滑动窗口+单调队列——思路清晰的一篇题解
算法·leetcode·机器人·题解·滑动窗口
.普通人4 小时前
c语言--力扣简单题目(回文链表)讲解
c语言·leetcode·链表
程序猿练习生4 小时前
C++速通LeetCode简单第18题-杨辉三角(全网唯一递归法)
c++·算法·leetcode
DdddJMs__1354 小时前
C语言 | Leetcode C语言题解之题409题最长回文串
c语言·leetcode·题解
重生之我要进大厂9 小时前
LeetCode 876
java·开发语言·数据结构·算法·leetcode
孙小二写代码10 小时前
[leetcode刷题]面试经典150题之1合并两个有序数组(简单)
算法·leetcode·面试