当前位置:网站首页>刷题《剑指Offer》day07
刷题《剑指Offer》day07
2022-07-31 08:11:00 【吃豆人编程】
题目来源:力扣《剑指Offer》第二版
完成时间:2022/07/29
17. 打印从1到最大的n位数

我的题解
class Solution {
public:
vector<int> printNumbers(int n) {
vector<int> result;
for(int i = 1;i < pow(10,n);i++) {
result.push_back(i);
}
return result;
}
};
18. 删除链表的节点

我的题解
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */
class Solution {
public:
ListNode* deleteNode(ListNode* head, int val) {
ListNode* head1 = new ListNode(-1);
head1->next = head;
ListNode* tmp = head1;
while(tmp->next){
if(tmp->next->val == val){
tmp->next = tmp->next->next;
break;
}
tmp = tmp->next;
}
return head1->next;
}
};
边栏推荐
- 【小程序项目开发--京东商城】uni-app之自定义搜索组件(上)-- 组件UI
- 《如何戒掉坏习惯》读书笔记
- I advise those juniors and juniors who have just started working: If you want to enter a big factory, you must master these core skills!Complete Learning Route!
- 使用PageHelper实现分页查询(详细)
- MySQL 数据库基础知识(系统化一篇入门)
- 一、MySQL主从复制原理
- 剑指offer-解决面试题的思路
- 中软国际携手深开鸿发布(1+1) x N 战略,以数字化、智慧化改变人类生产和生活方式
- 【小程序项目开发-- 京东商城】uni-app之自定义搜索组件(下) -- 搜索历史
- 【MySQL功法】第4话 · 和kiko一起探索MySQL中的运算符
猜你喜欢
随机推荐
[Mini Program Project Development--Jingdong Mall] Custom Search Component of uni-app (Part 1)--Component UI
C# 正则表达式汇总
会话技术之Coookie && Session详解
LED flashing on CY7C68013A
SSM整合案例分析(详解)
模块化规范
Vscode:Project-tree插件
SQLAlchemy使用教程
哪些字符串会被FastJson解析为null呢
Practical Bioinformatics 2: Multi-omics data integration and mining
MySQL 8.0.29 解压版安装教程(亲测有效)
中软国际携手深开鸿发布(1+1) x N 战略,以数字化、智慧化改变人类生产和生活方式
免安装版的Mysql安装与配置——详细教程
2019 NeurIPS | Graph Convolutional Policy Network for Goal-Directed Molecular Graph Generation
A, MySQL principle of master-slave replication
关于@Autowired
NK - RTU980 burning bare-metal program
0730~Mysql optimization
[Cloud native] Introduction and use of Feign of microservices
PowerCLi 一键批量部署OVA 到esxi 7









