当前位置:网站首页>Sword finger offer 17 Print from 1 to maximum n digits
Sword finger offer 17 Print from 1 to maximum n digits
2022-06-30 18:28:00 【anieoo】
Original link : The finger of the sword Offer 17. Print from 1 To the biggest n digit

solution:
dfs, Consider large numbers
class Solution {
public:
vector<int> res;
string path;
vector<int> printNumbers(int n) {
dfs(n);
return res;
}
void dfs(int n) {
if(path.size() == n) {
int num = stoi(path);
if(num) res.push_back(num); //num It's not equal to 0 Just save
return;
}
for(int i = 0;i < 10;i++) {
path.push_back(i + '0');
dfs(n);
path.pop_back();
}
}
};边栏推荐
- [PROJECT] Xiaomao school (IX)
- Openlayers roller shutter map
- New research of HKUST & MsrA: about image to image conversion, finishing is all you need
- 基于SSH的客户关系CRM管理系统
- Rust 操控大疆可编程无人机 tello
- Lenovo's "dual platform" operation and maintenance solution helps to comprehensively improve the intelligent management ability of the intelligent medical industry
- Post office - post office issues (dynamic planning)
- Vulnerability recurrence ----37. Apache unomi Remote Code Execution Vulnerability (cve-2020-13942)
- Talk about the SQL server version of DTM sub transaction barrier function
- Flink系列:checkpoint调优
猜你喜欢

Rainbow Brackets 插件的快捷键

Animesr: learnable degradation operator and new real world animation VSR dataset

Oneortwo bugs in "software testing" are small things, but security vulnerabilities are big things. We must pay attention to them

Another CVPR 2022 paper was accused of plagiarism, and Ping An insurance researchers sued IBM Zurich team

Talk about the SQL server version of DTM sub transaction barrier function

清华只能排第3?2022软科中国大学AI专业排名发布

If you want to learn software testing, you must see series, 2022 software testing engineer's career development

Redis (VII) - sentry

In distributed scenarios, do you know how to generate unique IDs?

New research of HKUST & MsrA: about image to image conversion, finishing is all you need
随机推荐
What should I pay attention to when playing futures? Where is safe to open an account? It's my first contact
Daily interview 1 question - how to prevent CDN protection from being bypassed
New research of HKUST & MsrA: about image to image conversion, finishing is all you need
Deep understanding of JVM (III) - memory structure (III)
If you want to learn software testing, you must see series, 2022 software testing engineer's career development
这里数据过滤支持啥样的sql语句
C language structure
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
「杂谈」对数据分析未来的几点思考
抖音最新Xbogus,signature生成js逆向分析
[software testing] basic knowledge of software testing you need to know
Deep understanding of JVM (I) - memory structure (I)
[bjdctf2020]the mystery of ip|[ciscn2019 southeast China division]web11|ssti injection
Unity开发bug记录100例子(第1例)——打包后shader失效或者bug
Tide - 基于 async-std 的 Rust-web 框架
MySQL n'a pas pu trouver MySQL. Solution temporaire pour le fichier Sock
Communication network electronic billing system based on SSH
MySQL找不到mysql.sock文件的临时解
How to solve the lock-in read-only alarm of AutoCAD Chinese language?
Small tools (3) integration knife4j3.0.3 interface document