当前位置:网站首页>剑指 Offer 17. 打印从1到最大的n位数
剑指 Offer 17. 打印从1到最大的n位数
2022-07-03 12:10:00 【嗝~~~~】
剑指 Offer 17. 打印从1到最大的n位数
难度简单229收藏分享切换为英文接收动态反馈
输入数字 n,按顺序打印出从 1 到最大的 n 位十进制数。比如输入 3,则打印出 1、2、3 一直到最大的 3 位数 999。
示例 1:
输入: n = 1输出: [1,2,3,4,5,6,7,8,9]
说明:
- 用返回一个整数列表来代替打印
- n 为正整数
代码
class Solution {
public:
vector<int> printNumbers(int n) {
vector<int> res(pow(10,n)-1);
for(int i=1;i<=pow(10,n)-1;i++){
res[i-1]=i;
}
return res;
}
};
边栏推荐
- (最新版) Wifi分销多开版+安装框架
- Pytext training times error: typeerror:__ init__ () got an unexpected keyword argument 'serialized_ options'
- context. Getexternalfilesdir() is compared with the returned path
- Approve iPad, which wants to use your icloud account
- Grid connection - Analysis of low voltage ride through and island coexistence
- Sqoop1.4.4原生增量导入特性探秘
- Kotlin - 改良装饰者模式
- Social community forum app ultra-high appearance UI interface
- 【数据库原理及应用教程(第4版|微课版)陈志泊】【第三章习题】
- Kotlin notes - popular knowledge points asterisk (*)
猜你喜欢

Public and private account sending prompt information (user microservice -- message microservice)

最新版盲盒商城thinkphp+uniapp

studio All flavors must now belong to a named flavor dimension. Learn more
![[comprehensive question] [Database Principle]](/img/d7/8c51306bb390e0383a017d9097e1e5.png)
[comprehensive question] [Database Principle]

低代码平台国际化多语言(i18n)技术方案

Node. Js: use of express + MySQL

【R】【密度聚类、层次聚类、期望最大化聚类】
![[review questions of database principles]](/img/c3/81d192a40bcc4f5d72fcbe76c708bb.png)
[review questions of database principles]

【数据库原理及应用教程(第4版|微课版)陈志泊】【SQLServer2012综合练习】

How to convert a decimal number to binary in swift
随机推荐
C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep271
Brief introduction to mvcc
Togaf certification self-study classic v2.0
Openstack node address change
Gan totem column bridgeless boost PFC (single phase) seven PFC duty cycle feedforward
十条职场规则
最新版盲盒商城thinkphp+uniapp
【数据库原理及应用教程(第4版|微课版)陈志泊】【第三章习题】
高效能人士的七个习惯
Simple use and precautions of kotlin's array array and set list
The latest version of lottery blind box operation version
十條職場規則
Xctf mobile--app3 problem solving
studio All flavors must now belong to a named flavor dimension. Learn more
Swift5.7 扩展 some 到泛型参数
Redhat5 installing socket5 proxy server
Analysis of the influence of voltage loop on PFC system performance
最新版抽奖盲盒运营版
有限状态机FSM
Swift Error Handling