C语言链表——头插法和尾插法

摘要: #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> typedef struct ListNode{ int val; ListNode* next; }Node_t, *pNode_t; void print_l 阅读全文
posted @ 2021-02-02 20:59 平ping 阅读(406) 评论(0) 推荐(0) 编辑

C语言——创建动态二维数组

摘要: int main() { int **a; int row, column; int count = 0; scanf("%d%d", &row, &column); a = (int **)malloc(row * sizeof(int *)); for (int i = 0; i < row; 阅读全文
posted @ 2021-02-01 21:05 平ping 阅读(444) 评论(0) 推荐(0) 编辑

c笔记——指针错误情况

摘要: 指针错误情况: 1、空指针 指向不可访问的地址: { int *p; *p = 1; } 2、野指针 指向未分配空间的地址: { int *p; p = NULL; *p = 1; } 指向未知的特定地址 { char *p = 0x00123456; *p = 1; } 3、悬空指针 使用了已经f 阅读全文
posted @ 2021-01-30 22:48 平ping 阅读(166) 评论(0) 推荐(0) 编辑

输入年,输出一整年的日历

摘要: 输入年,输出一整年的日历 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include<math.h> int Year_return, Month_return, Days_return; //date_after_days()的传出参数 阅读全文
posted @ 2021-01-29 19:49 平ping 阅读(228) 评论(0) 推荐(0) 编辑

Leetcode 739. 每日温度 ——栈

摘要: 请根据每日 气温 列表,重新生成一个列表。对应位置的输出为:要想观测到更高的气温,至少需要等待的天数。如果气温在这之后都不会升高,请在该位置用 0 来代替。 例如,给定一个列表 temperatures = [73, 74, 75, 71, 69, 72, 76, 73],你的输出应该是 [1, 1 阅读全文
posted @ 2021-01-27 17:40 平ping 阅读(46) 评论(0) 推荐(0) 编辑

leetcode 316. 去除重复字母 ——去重

摘要: #include <iostream> #include <vector> #include <queue> #include <algorithm> #include <string> using namespace std; class Solution { public: string rem 阅读全文
posted @ 2021-01-27 16:52 平ping 阅读(53) 评论(0) 推荐(0) 编辑

双指针——leetcode15——三数之和

摘要: #include <iostream> #include <vector> #include <algorithm> using namespace std; /*原理:双指针法 先将数组排序! 设定一个 p ,然后设定左指针 L = p + 1 ,右指针 R = size - 1 ; 要逼近的数是 阅读全文
posted @ 2021-01-18 23:13 平ping 阅读(38) 评论(0) 推荐(0) 编辑

leetcode746——爬楼梯——动态规划

摘要: #include <iostream> #include <vector> #include <algorithm> using namespace std; //原理:动态规划法 //到达a56爆大奖在线娱乐阶梯都有一个理论上的最小体力minCost,按照minCost[i] = min(minCost[i-2] 阅读全文
posted @ 2021-01-18 22:14 平ping 阅读(33) 评论(0) 推荐(0) 编辑

八皇后——回溯法

摘要: 1 #include <iostream> 2 #include <vector> 3 #include <string> 4 #include <queue> 5 #include <stack> 6 #include <algorithm> 7 using namespace std; 8 9 阅读全文
posted @ 2021-01-18 21:10 平ping 阅读(43) 评论(0) 推荐(0) 编辑