
LeetCode算法题
文章平均质量分 93
记录LeetCode算法题的题解
諒口叁叁
一位尚在努力的普通人
展开
-
【LeetCode】1319.连通网络的操作次数(Number of Operations to Make Network Connected)
目录题目描述题目大意解题方法方法一:并查集题目描述There are n computers numbered from 0 to n-1 connected by ethernet cables connections forming a network where connections[i] = [a, b] represents a connection between computers a and b. Any computer can reach any other computer di原创 2021-02-02 21:54:33 · 204 阅读 · 0 评论 -
【LeetCode】547.省份数量(Number of Provinces)
目录题目描述题目大意解题方法方法一:并查集题目描述There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly with city c.A province is a group原创 2021-02-02 20:10:36 · 935 阅读 · 0 评论 -
【LeetCode】1631.最小体力消耗路径(Path WIth Minimum Effort)
目录题目描述题目大意解题方法方法一:并查集题目描述You are a hiker preparing for an upcoming hike. You are given heights, a 2D array of size rows ×\times× columns, where heights[row][col] represents the height of cell (row, col). You are situated in the top-left cell, (0, 0), and原创 2021-01-30 22:22:35 · 316 阅读 · 0 评论 -
【LeetCode】724.寻找数组的中心索引
目录题目描述题目大意解题方法方法一:前缀和题目描述Given an array of integers nums, write a method that returns the “pivot” index of this array.We define the pivot index as the index where the sum of all the numbers to the left of the index is equal to the sum of all the numbers原创 2021-01-28 15:43:50 · 115 阅读 · 0 评论 -
【LeetCode】1128.等价多米诺骨牌对的数量
目录题目描述题目大意解题方法方法一:排序+双指针方法二:计数题目描述Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a == c and b == d), or (a == d) - that is, one domino can be rotated to be equal to another domino.Return the n原创 2021-01-28 12:27:17 · 170 阅读 · 0 评论