初一看,sb题,上去一个并查集,很快啊,返回一个MLE,定睛一看,系统开的内存很小,但是这个算法复杂度又是这么正确 因此考虑优化内存,这样用滚动数组优化即可 #include<bits/stdc++.h> using namespace std; typedef long long ll; type ...
分类:
其他好文 时间:
2020-12-10 11:39:56
阅读次数:
13
题目 74. 搜索二维矩阵 思路1(暴力) 遍历二维数组的所有的元素,看看是否存在target 代码 class Solution { public boolean searchMatrix(int[][] matrix, int target) { for (int i = 0; i < matr ...
分类:
其他好文 时间:
2020-12-03 11:50:12
阅读次数:
4
此博客连接:https://www.cnblogs.com/ping2yingshi/p/14054440.html 存在重复元素2 题目链接:https://leetcode-cn.com/problems/contains-duplicate-ii/submissions/ 题目 给定一个整数数 ...
分类:
其他好文 时间:
2020-12-03 11:48:40
阅读次数:
2
problem: 给你n个数字,和m个查询. 将[l,r]之间数第一次出现的位置信息弄成一个新的数组,然后找出其中k/2大的数.(k为位置的数量) #include<bits/stdc++.h> using namespace std; const int maxn=2e5+100; const i ...
分类:
其他好文 时间:
2020-11-26 14:12:20
阅读次数:
3
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted i ...
分类:
其他好文 时间:
2020-11-25 12:59:50
阅读次数:
14
LeetCode82 删除排序链表中的重复元素II 题目描述 给定一个排序链表,删除所有含有重复数字的节点,只保留原始链表中 没有重复出现 的数字。 样例 输入: 1->2->3->3->4->4->5 输出: 1->2->5 输入: 1->1->1->2->3 输出: 2->3 算法分析 时间复杂 ...
分类:
编程语言 时间:
2020-11-24 12:38:37
阅读次数:
6
LeetCode81 搜索旋转排序数组II 题目描述 假设按照升序排序的数组在预先未知的某个点上进行了旋转。 ( 例如,数组 [0,0,1,2,2,5,6] 可能变为 [2,5,6,0,0,1,2] )。 编写一个函数来判断给定的目标值是否存在于数组中。若存在返回 true,否则返回 false。 ...
分类:
编程语言 时间:
2020-11-24 12:11:34
阅读次数:
7
leetcode(daily 11-8 ~ 11-14) leetcode 每日一题 11-8 122. 买卖股票的最佳时机 II class Solution { public int maxProfit(int[] prices) { // 贪心算法:只要今天买明天赚就买入 // profit用 ...
分类:
其他好文 时间:
2020-11-20 12:09:49
阅读次数:
9
由于quartus 19.4不支持直接在工程中启动modelsim一起联合仿真,所以需要自己写tb文件。 对于一个新安装的quartus 19.4。 首先需要做的第一步: 点击“Launch Simlulation Library Compiler”生成altera的库文件。 进入下图所示: 1、选 ...
分类:
其他好文 时间:
2020-11-19 12:38:17
阅读次数:
6
LeetCode63 不同路径II 题目描述 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。 现在考虑网格中有障碍物。那么从左上角到右下角将会有多少条不同的路 ...
分类:
其他好文 时间:
2020-11-19 12:13:01
阅读次数:
4