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)

模拟

相关推荐
G.O.G.O.G1 小时前
LeetCode SQL 从入门到精通(MySQL)06(上)
数据库·sql·mysql·leetcode
闪电悠米3 小时前
力扣hot100-56.合并区间-排序详解
数据结构·算法·leetcode·贪心算法·排序算法
卡提西亚5 小时前
leetcode-1438. 绝对差不超过限制的最长连续子数组
算法·leetcode·职场和发展
Java面试题总结5 小时前
LeetCode 93.复原IP地址
算法·leetcode·职场和发展·.net
Frostnova丶10 小时前
(17)LeetCode 41. 缺失的第一个正数
数据结构·算法·leetcode
旖-旎11 小时前
《LeetCode 416 分割等和子集》
c++·算法·leetcode·动态规划·背包问题
闪电悠米13 小时前
力扣hot100-53.最大子数组和-动态规划详解
算法·leetcode·动态规划·dp·hot100
晚笙coding1 天前
LeetCode 226. 翻转二叉树(Invert Binary Tree)
算法·leetcode·职场和发展
退休倒计时1 天前
【每日一题】LeetCode 287. 寻找重复数 TypeScript
算法·leetcode·typescript
Tisfy1 天前
LeetCode 3658.奇数和与偶数和的最大公约数:数论 / 数学O(1)
数学·算法·leetcode·数论·题解