剑指OFFER----面试题17- 打印从1到最大的n位数

链接:https://leetcode-cn.com/problems/da-yin-cong-1dao-zui-da-de-nwei-shu-lcof/

 

代码:

class Solution {
public:
    vector<int> printNumbers(int n) {
        int res = pow(10, n);
        vector<int> tmp;
        for (int i = 1; i < res; ++i) tmp.push_back(i);
        return tmp; 
    }
};

 

posted @ 2020-02-21 10:08  景云ⁿ  阅读(97)  评论(0编辑  收藏  举报