题目:
题解:
class Solution:def lexicalOrder(self, n: int) -> List[int]:ans = [0] * nnum = 1for i in range(n):ans[i] = numif num * 10 <= n:num *= 10else:while num % 10 == 9 or num + 1 > n:num //= 10num += 1return ans
题目:
题解:
class Solution:def lexicalOrder(self, n: int) -> List[int]:ans = [0] * nnum = 1for i in range(n):ans[i] = numif num * 10 <= n:num *= 10else:while num % 10 == 9 or num + 1 > n:num //= 10num += 1return ans