当前位置:网站首页>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;
}
};
边栏推荐
- Application of ncnn neural network computing framework in orange school orangepi 3 lts development board
- Quick learning 1.8 front and rear interfaces
- Loan calculator my pressure is high
- SSH登录服务器发送提醒
- Integer case study of packaging
- How to get user location in wechat applet?
- GCN thinking - word2vec directly calculates text classification
- 对业务的一些思考
- 【R】【密度聚类、层次聚类、期望最大化聚类】
- Glide question you cannot start a load for a destroyed activity
猜你喜欢

Application of ncnn neural network computing framework in orange school orangepi 3 lts development board

Harmonic current detection based on synchronous coordinate transformation

Four problems and isolation level of MySQL concurrency

Xctf mobile--app3 problem solving

最新版盲盒商城thinkphp+uniapp

Social community forum app ultra-high appearance UI interface

【Colab】【使用外部数据的7种方法】

Sword finger offer14 the easiest way to cut rope

高效能人士的七个习惯

【数据挖掘复习题】
随机推荐
C graphical tutorial (Fourth Edition)_ Chapter 13 entrustment: delegatesamplep245
When the R language output rmarkdown is in other formats (such as PDF), an error is reported, latex failed to compile stocks Tex. solution
Detailed explanation of the most complete constraintlayout in history
Project video based on Linu development
Enable SASL authentication for memcached
Day 1 of kotlin learning: simple built-in types of kotlin
CNN MNIST handwriting recognition
Analysis of a music player Login Protocol
Swift bit operation exercise
Deeply understand the mvcc mechanism of MySQL
【数据库原理及应用教程(第4版|微课版)陈志泊】【第四章习题】
Swift5.7 extend some to generic parameters
Pytext training times error: typeerror:__ init__ () got an unexpected keyword argument 'serialized_ options'
Leetcode234 palindrome linked list
[exercise 5] [Database Principle]
C graphical tutorial (Fourth Edition)_ Chapter 13 entrustment: what is entrustment? P238
Analysis of the influence of voltage loop on PFC system performance
Airflow installation jump pit
剑指 Offer 14- I. 剪绳子
Dojo tutorials:getting started with deferrals source code and example execution summary