剑指Offer 17 打印从1到最大的n位数

leetcode地址,Java版代码:

1 class Solution {
2     public int[] printNumbers(int n) {
3         int end = (int)Math.pow(10, n) - 1;
4         int[] res = new int[end];
5         for(int i = 0; i < end; i++)
6             res[i] = i + 1;
7         return res;
8     }
9 }
原文地址:https://www.cnblogs.com/asenyang/p/13671376.html