当前位置:网站首页>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;
}
};
边栏推荐
- Project video based on Linu development
- Glide question you cannot start a load for a destroyed activity
- 剑指 Offer 17. 打印从1到最大的n位数
- Loan calculator my pressure is high
- 解决 System has not been booted with systemd as init system (PID 1). Can‘t operate.
- [exercise 6] [Database Principle]
- 基于Linu开发的项目视频
- initial、inherit、unset、revert和all的区别
- Export the entire Oracle Database
- Harmonic current detection based on synchronous coordinate transformation
猜你喜欢

When the R language output rmarkdown is in other formats (such as PDF), an error is reported, latex failed to compile stocks Tex. solution

Four problems and isolation level of MySQL concurrency

sitesCMS v3.1.0发布,上线微信小程序

GaN图腾柱无桥 Boost PFC(单相)七-PFC占空比前馈

Glide question you cannot start a load for a destroyed activity

01 three solutions to knapsack problem (greedy dynamic programming branch gauge)

Xctf mobile--app3 problem solving

Analysis of the influence of voltage loop on PFC system performance

Low code platform international multilingual (I18N) technical solution

自抗扰控制器七-二阶 LADRC-PLL 结构设计
随机推荐
CVPR 2022 图像恢复论文
Analysis of a music player Login Protocol
luoguP3694邦邦的大合唱站队
Approve iPad, which wants to use your icloud account
[exercise 6] [Database Principle]
[comprehensive question] [Database Principle]
GCN thinking - word2vec directly calculates text classification
[exercise 7] [Database Principle]
2022-01-27 redis cluster brain crack problem analysis
[exercice 7] [principe de la base de données]
Day 1 of kotlin learning: simple built-in types of kotlin
Do you feel like you've learned something and forgotten it?
Huffman coding experiment report
Node.js: express + MySQL的使用
Everything comes to him who waits
【習題七】【數據庫原理】
SLF4J 日志门面
基于同步坐标变换的谐波电流检测
C graphical tutorial (Fourth Edition)_ Chapter 17 generic: genericsamplep315
ORM use of node -serialize