当前位置:网站首页>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;
}
};
边栏推荐
- 【習題五】【數據庫原理】
- Create a dojo progress bar programmatically: Dojo ProgressBar
- IDEA 全文搜索快捷键Ctr+Shift+F失效问题
- Attack and defense world mobile--ph0en1x-100
- 最新版抽奖盲盒运营版
- 4. 无线体内纳米网:电磁传播模型和传感器部署要点
- 社交社区论坛APP超高颜值UI界面
- studio All flavors must now belong to a named flavor dimension. Learn more
- (latest version) WiFi distribution multi format + installation framework
- 强大的头像制作神器微信小程序
猜你喜欢

自抗扰控制器七-二阶 LADRC-PLL 结构设计

Drop down refresh conflicts with recyclerview sliding (swiperefreshlayout conflicts with recyclerview sliding)

Two solutions of leetcode101 symmetric binary tree (recursion and iteration)

社交社区论坛APP超高颜值UI界面

剑指 Offer 12. 矩阵中的路径

Cache penetration and bloom filter

基于同步坐标变换的谐波电流检测

Method overloading and rewriting

The latest version of lottery blind box operation version

IDEA 全文搜索快捷键Ctr+Shift+F失效问题
随机推荐
Application of ncnn Neural Network Computing Framework in Orange Pi 3 Lts Development Board
电压环对 PFC 系统性能影响分析
C graphical tutorial (Fourth Edition)_ Chapter 18 enumerator and iterator: enumerator samplep340
2022-02-09 survey of incluxdb cluster
【综合题】【数据库原理】
luoguP3694邦邦的大合唱站队
Deeply understand the mvcc mechanism of MySQL
剑指 Offer 17. 打印从1到最大的n位数
Social community forum app ultra-high appearance UI interface
CNN MNIST handwriting recognition
Sword finger offer14 the easiest way to cut rope
Bert running error: attributeerror: module'tensorflow contrib. tpu' has no attribute 'InputPipelineConfig'
[judgment question] [short answer question] [Database Principle]
Dojo tutorials:getting started with deferrals source code and example execution summary
[network counting] Chapter 3 data link layer (2) flow control and reliable transmission, stop waiting protocol, backward n frame protocol (GBN), selective retransmission protocol (SR)
Loan calculator my pressure is high
Exploration of sqoop1.4.4 native incremental import feature
4. 无线体内纳米网:电磁传播模型和传感器部署要点
ncnn神經網絡計算框架在香柳丁派OrangePi 3 LTS開發板中的使用介紹
自抗扰控制器七-二阶 LADRC-PLL 结构设计