当前位置:网站首页>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;
}
};
边栏推荐
- How to stand out quickly when you are new to the workplace?
- [ArcGIS user defined script tool] vector file generates expanded rectangular face elements
- Pytext training times error: typeerror:__ init__ () got an unexpected keyword argument 'serialized_ options'
- It feels great to know you learned something, isn‘t it?
- Do you feel like you've learned something and forgotten it?
- 2022-01-27 redis cluster brain crack problem analysis
- C graphical tutorial (Fourth Edition)_ Chapter 20 asynchronous programming: examples - cases without asynchronous
- 【综合题】【数据库原理】
- 【判断题】【简答题】【数据库原理】
- alright alright alright
猜你喜欢

Xctf mobile--app3 problem solving

IDEA 全文搜索快捷键Ctr+Shift+F失效问题

Leetcode234 palindrome linked list

Day 1 of kotlin learning: simple built-in types of kotlin

Xctf mobile--app2 problem solving

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

ncnn神经网络计算框架在香橙派OrangePi 3 LTS开发板中的使用介绍

强大的头像制作神器微信小程序
![[comprehensive question] [Database Principle]](/img/d7/8c51306bb390e0383a017d9097e1e5.png)
[comprehensive question] [Database Principle]

Powerful avatar making artifact wechat applet
随机推荐
How to convert a decimal number to binary in swift
Swift return type is a function of function
【Colab】【使用外部数据的7种方法】
电压环对 PFC 系统性能影响分析
我的创作纪念日:五周年
Nodejs+express+mysql realizes login function (including verification code)
[review questions of database principles]
Method overloading and rewriting
并网-低电压穿越与孤岛并存分析
Dix règles de travail
Application of ncnn Neural Network Computing Framework in Orange Pi 3 Lts Development Board
[exercice 7] [principe de la base de données]
【数据库原理及应用教程(第4版|微课版)陈志泊】【第六章习题】
Kotlin notes - popular knowledge points asterisk (*)
alright alright alright
IDEA 全文搜索快捷键Ctr+Shift+F失效问题
Social community forum app ultra-high appearance UI interface
2022-02-09 survey of incluxdb cluster
Pytext training times error: typeerror:__ init__ () got an unexpected keyword argument 'serialized_ options'
Everything comes to him who waits