当前位置:网站首页>Sword finger offer 17 Print from 1 to the maximum n digits
Sword finger offer 17 Print from 1 to the maximum n digits
2022-07-03 12:59:00 【Hiccup~~~~】
The finger of the sword Offer 17. Print from 1 To the biggest n digit
The difficulty is simple 229 Switch to English to receive dynamic feedback
Input number n, Print out from... In order 1 To the biggest n A decimal number . Such as input 3, Then print out 1、2、3 Up to the biggest 3 digit 999.
Example 1:
Input : n = 1 Output : [1,2,3,4,5,6,7,8,9]
explain :
- Instead of printing, return a list of integers
- n As a positive integer
Code
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;
}
};
边栏推荐
- [exercise 6] [Database Principle]
- luoguP3694邦邦的大合唱站队
- 基于Linu开发的项目视频
- 剑指 Offer 16. 数值的整数次方
- Airflow installation jump pit
- [review questions of database principles]
- An example of newtonjason
- [data mining review questions]
- Bert running error: attributeerror: module'tensorflow contrib. tpu' has no attribute 'InputPipelineConfig'
- It feels great to know you learned something, isn‘t it?
猜你喜欢
Seven second order ladrc-pll structure design of active disturbance rejection controller
Swift bit operation exercise
[data mining review questions]
IDEA 全文搜索快捷键Ctr+Shift+F失效问题
电压环对 PFC 系统性能影响分析
OpenHarmony应用开发之ETS开发方式中的Image组件
低代码平台国际化多语言(i18n)技术方案
Powerful avatar making artifact wechat applet
对业务的一些思考
Analysis of the influence of voltage loop on PFC system performance
随机推荐
T430 toss and install OS majave 10.14
【综合题】【数据库原理】
[judgment question] [short answer question] [Database Principle]
初入职场,如何快速脱颖而出?
Oh my Zsh + TMUX installation
luoguP3694邦邦的大合唱站队
自抗扰控制器七-二阶 LADRC-PLL 结构设计
Kung Fu pays off, and learning is done
[review questions of database principles]
高效能人士的七个习惯
Analysis of a music player Login Protocol
The upward and downward transformation of polymorphism
最新版盲盒商城thinkphp+uniapp
I'm too lazy to write more than one character
【Colab】【使用外部数据的7种方法】
【习题七】【数据库原理】
Ali & ant self developed IDE
An example of newtonjason
C graphical tutorial (Fourth Edition)_ Chapter 13 entrustment: what is entrustment? P238
【数据库原理及应用教程(第4版|微课版)陈志泊】【第五章习题】