1 题目 "LeetCode第26题" ,给出一个非降序的数组,删除重复的元素. 2 覆盖移动 题目明确要求不能使用额外的数组空间,一开始,没想到什么好的算法. 但是,它又有提示,不需要考虑数组中超出新长度后面的元素,所有,就想到了覆盖移动这样的方法. 思想很简单,就是使用两个下标,一个下标表示要返 ...
分类:
编程语言 时间:
2020-01-31 23:13:08
阅读次数:
149
这道题就是单调队列的裸题 今天刚学的单调队列 前几天刚学习完单调栈 感觉这两个东西非常相似哇 黄哥的一句话说破了他 他俩的区别就像队列和栈的区别233333 有关这道题倒没有太多说的 就是模拟队列 单调递增递减来找到区间最值 我这里用了数组模拟 问题就是G++ T了/// 而C++ AC 就很迷。。 ...
分类:
其他好文 时间:
2020-01-31 18:32:19
阅读次数:
79
题目链接 解法: 竞赛图没有自环,没有二元环;若竞赛图存在环,则一定存在三元环。 简单证明: 假设一个竞赛图存在一个 N 元环(大于三元),环上有连续三点 A , B , C ( 存在有向边 AB , BC ) 根据竞赛图的定义,一定存在有向边 CA 或 AC 中的一者。 情况 1 :若存在 CA ...
分类:
其他好文 时间:
2020-01-31 15:47:02
阅读次数:
138
Maximum sum AC_Code 1 #include <iostream> 2 #include <cstdio> 3 #include <string> 4 #include <cstring> 5 #include <string> 6 #include <cmath> 7 #inclu ...
分类:
其他好文 时间:
2020-01-31 12:29:11
阅读次数:
73
1 题目 "LeetCode第23题" ,合并k个有序的链表. 2 暴力法 直接遍历所有链表,取出所有节点的值,用数组存储,非降序排序,然后创建一个新链表用头插法依次插入节点. 这里要注意一下,sort那里不能写成: 没有考虑到等于的情况,所以用compareTo代替: 3 直接合并法 每次遍历所有 ...
分类:
编程语言 时间:
2020-01-31 10:52:27
阅读次数:
99
最长公共子上升序列 AC_Code 1 #include <iostream> 2 #include <cstdio> 3 #include <string> 4 #include <cstring> 5 #include <string> 6 #include <cmath> 7 #include ...
分类:
其他好文 时间:
2020-01-31 10:52:09
阅读次数:
68
友好城市 解题思路:不交叉,则将北岸的坐标从小到大排,找南岸的最长上升子序列 AC_Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 #include <algorithm> 5 #include <bits/st ...
分类:
编程语言 时间:
2020-01-31 01:09:11
阅读次数:
96
文本 <input v-model="message" placeholder="edit me"> <p>Message is: {{ message }}</p> 多行文本 <span>Multiline message is:</span> <p style="white-space: pre ...
分类:
其他好文 时间:
2020-01-30 22:50:50
阅读次数:
85
免费馅饼 数字三角形变形: AC_Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <string> 5 #include <cmath> 6 #include <algorithm> 7 u ...
分类:
其他好文 时间:
2020-01-30 22:38:59
阅读次数:
64