当前位置:网站首页>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();
}
}
};边栏推荐
- Optimization of interface display for general kernel upgrade of mobo video management system v3.5.0
- 云安全日报220630:IBM数据保护平台发现执行任意代码漏洞,需要尽快升级
- Add code block in word (Reprint)
- 又一篇CVPR 2022论文被指抄袭,平安保险研究者控诉IBM苏黎世团队
- ASP. Net generate verification code
- Deep understanding of JVM (II) - memory structure (II)
- MySQL advanced - index optimization (super detailed)
- Only black-and-white box test is required for test opening post? No, but also learn performance test
- MySQL找不到mysql.sock文件的临时解
- 「经验」浅谈聚类分析在工作中的应用
猜你喜欢

Redis (I) - data type

基于SSH的客户关系CRM管理系统

Do you write API documents or code first?

Deep understanding of JVM (IV) - garbage collection (I)

Solve the problem of unable to connect to command metric stream and related problems in the hystrix dashboard

MySQL advanced - basic index and seven joins

Volcano engine was selected into the first "panorama of edge computing industry" in China

New research of HKUST & MsrA: about image to image conversion, finishing is all you need

Vulnerability recurrence ----37. Apache unomi Remote Code Execution Vulnerability (cve-2020-13942)

Inventory in the first half of 2022: summary of major updates and technical points of 20+ mainstream databases
随机推荐
Type ~ storage ~ variable in C #
抖音最新Xbogus,signature生成js逆向分析
autocad中文语言锁定只读警报怎么解决?
Advanced embedded application of uni app [day14]
It's not easy to say I love you | use the minimum web API to upload files
Nft: unlimited possibilities to open the era of encryption Art
基于SSH的网上商城设计
使用excel快速生成sql语句
力扣解法汇总1175-质数排列
Synchronized summary
助力极致体验,火山引擎边缘计算最佳实践
分布式场景下,你知道有几种生成唯一ID的方式嘛?
[machine learning] K-means clustering analysis
MySQL reports that the column timestamp field cannot be null
Do you write API documents or code first?
Animesr: learnable degradation operator and new real world animation VSR dataset
Optimization of interface display for general kernel upgrade of mobo video management system v3.5.0
Rainbow Brackets 插件的快捷键
News management system based on SSM
Post MSF infiltration summary