注意基数和最终结果



public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param n int整型 最大位数
     * @return int整型一维数组
     */
    public int[] printNumbers (int n) {
        // write code here
        int base = 10 ;
        int len = 1;
        while(n > 0){
            len *= base;
            n--;
        }
        int[] res = new int[len-1];
        for(int i = 0; i< len-1; i++){
            res[i] = i+1;
        }
        return res;
    }
}