<doocs>0386.Lexicographical Numbers_1.py
def lexicalOrder( n: int) -> List[int]:
    v = 1
    ans = []
    for i in range(n):
        ans.append(v)
        if v * 10 <= n:
            v *= 10
        else:
            while v % 10 == 9 or v + 1 > n:
                v //= 10
            v += 1
    return ans
def sample_funcname ( var_0 : int ) -> List [ int ] :
    var_4 = 1
    var_5 = [ ]
    for var_7 in range ( var_0 ) :
        var_5.append ( var_4 )
        if var_4 * 10 <= var_0 :
            var_4 *= 10
        else :
            while var_4 % 10 == 9 or var_4 + 1 > var_0 :
                var_4 //= 10
            var_4 += 1
    return var_5
