![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
刷题
Icoding_F2014
相信代码可以变化世界
展开
-
leetcode 1288. Remove Covered Intervals
Given an array intervals where intervals[i] = [li, ri] represent the interval [li, ri), remove all intervals that are covered by another interval in the list.The interval [a, b) is covered by the interval [c, d) if and only if c <= a and b <= d.Ret原创 2021-09-16 00:42:57 · 229 阅读 · 0 评论 -
刷题:基于拓扑排序的图的环检测算法
有向图,环检测:给定一个有向图,检测里面是否存在环。有向图的环是指,存在一条路径,使得这条路径的起点和终点相同。无向图,环检测:给定一个无向图,检测里面是否存在环。无向图的环是指,存在一条路径,使得这条路径的起点和终点相同。方法:基于拓扑排序的方法:基于拓扑排序可以判断一个图是不是存在环,但是无法解决这个图里面环的个数、环里面节点元素是啥。拓扑排序的算法为:对于有向图,首先将入度为0的节点入队。然后当队列不为空时:依次弹出队首元素;弹出过程中,将这个节点的所有邻居节点的入度都减原创 2021-09-14 07:48:39 · 788 阅读 · 0 评论 -
1497. Check If Array Pairs Are Divisible by k
题目描述:Given an array of integers arr of even length n and an integer k.We want to divide the array into exactly n / 2 pairs such that the sum of each pair is divisible by k.Return True If you can find a way to do that or False otherwise.给定一个包含偶数个元素的整数数组原创 2021-09-12 15:12:25 · 208 阅读 · 0 评论 -
leetcode: 连续子串和/积的相关题目汇总及总结
560. Subarray Sum Equals K题目Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.Example 1:Input:nums = [1,1,1], k = 2Ou...原创 2019-12-08 20:50:41 · 439 阅读 · 0 评论 -
LeetCode刷题指南(持续更新)
【128】最长数值连续递增子序列题目:https://leetcode.com/problems/longest-consecutive-sequence/description/解题方法:带路径压缩以及带元素统计的并查集https://blog.csdn.net/jmh1996/article/details/84198246 (应用部分)【200】小岛个数题目:https://l...原创 2018-11-18 15:45:16 · 1579 阅读 · 0 评论 -
54. Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.Example 1:Input:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]Output: [1,2,3,6,9,8,7,4,5]Exa...原创 2019-09-08 23:10:40 · 116 阅读 · 0 评论