LeetCode315 计算右侧小于当前元素的个数 发表于 2022-10-12 | 分类于 LeetCode | 字数统计: 364 | 阅读时长 ≈ 1 链接: https://leetcode.cn/problems/count-of-smaller-numbers-after-self/ 题意给你一个整数数组 nums ,按要求返回一个新数组 counts 。数组 counts 有该性质: counts[i] 的值是 nums[i] 右侧小于 nums[i] 的元素的数量 阅读全文 »
LeetCode354 俄罗斯套娃信封问题 发表于 2022-09-19 | 分类于 LeetCode | 字数统计: 657 | 阅读时长 ≈ 3 链接: https://leetcode.cn/problems/russian-doll-envelopes/ 题面给你一个二维整数数组 envelopes ,其中 envelopes[i] = [wi, hi] ,表示第 i 个信封的宽度和高度。当另一个信封的宽度和高度都比这个信封大的时候,这个信封就可以放进另一个信封里,如同俄罗斯套娃一样。请计算 最多能有多少个信封能组成一组“俄罗斯套娃”信封。 阅读全文 »
LeetCode743 网络延迟时间(Dijkstra存档) 发表于 2022-08-31 | 分类于 LeetCode | 字数统计: 409 | 阅读时长 ≈ 2 链接: https://leetcode.cn/problems/network-delay-time/ 题意给定一个网络连接图,其中有n个节点,求所有k到所有节点的最短距离的最大值 阅读全文 »
LeetCode90 子集 II 发表于 2022-08-22 | 分类于 LeetCode | 字数统计: 293 | 阅读时长 ≈ 1 链接: https://leetcode.cn/problems/subsets-ii/ 题意给你一个整数数组 nums ,其中可能包含重复元素,请你返回该数组所有可能的子集(幂集)。解集 不能 包含重复的子集。返回的解集中,子集可以按 任意顺序 排列。 阅读全文 »
LeetCode713 乘积小于K的子数组 发表于 2022-08-18 | 分类于 LeetCode | 字数统计: 239 | 阅读时长 ≈ 1 链接: https://leetcode.cn/problems/subarray-product-less-than-k/ 题意给你一个整数数组 nums 和一个整数 k ,请你返回子数组内所有元素的乘积严格小于 k 的连续子数组的数目。 阅读全文 »
LeetCode14 最长公共前缀 发表于 2022-08-18 | 分类于 LeetCode | 字数统计: 374 | 阅读时长 ≈ 1 链接: https://leetcode.cn/problems/longest-common-prefix/ 题意编写一个函数来查找字符串数组中的最长公共前缀。 阅读全文 »
LeetCode6137 检查数组是否存在有效划分 发表于 2022-08-07 | 分类于 LeetCode | 字数统计: 325 | 阅读时长 ≈ 1 链接: https://leetcode.cn/problems/check-if-there-is-a-valid-partition-for-the-array/ 题意给定一个数组如果获得的这些子数组中每个都能满足下述条件之一 ,则可以称其为数组的一种有效划分:子数组由 2 个相等元素组成,例如,子数组 [2,2] 。子数组由 3 个相等元素组成,例如,子数组 [4,4,4] 。子数组由 3 个连续递增元素组成,并且相邻元素之间的差值为 1 。例如,子数组 [3,4,5] 阅读全文 »
LeetCode164 最大间距 发表于 2022-07-15 | 分类于 LeetCode | 字数统计: 245 | 阅读时长 ≈ 1 链接: https://leetcode.cn/problems/maximum-gap/ 题意给定一个无序的数组 nums,返回 数组在排序之后,相邻元素之间最大的差值 。如果数组元素个数小于 2,则返回 0 。要求O(n)时间和空间复杂度 阅读全文 »