报数 (报数)

 

思路:

// @Title: 报数 (报数)
// @Author: qisiii
// @Date: 2022-02-20 15:06:38
// @Runtime: 1 ms
// @Memory: 48.6 MB
// @comment: 
// @flag: 
class Solution {
   public static int[] printNumbers(int n) {
        int fin=1;
        while (n>0){
            n--;
            fin=fin*10;

        }
        int[] result=new int[fin-1];
        for (int i = 0; i < result.length; i++) {
           result[i]=i+1;
        }
        return result;
    }
}
Licensed under CC BY-NC-SA 4.0
最后更新于 2024-10-18