236.lowest_common_ancestor_of_a_binary_tree 2367.number_of_arithmetic_triplets 238.product_of_array_except_self 2390.removing_stars_from_a_string 242.valid_anagram 2441.largest_positive_integer_that_exists_with_
404-sum-of-left-leaves 409-longest-palindrome 41-first-missing-positive 42-trapping-rain-water 435-non-overlapping-intervals 442-find-all-duplicates-in-an-array 445-add-two-numbers-ii 446-arithmetic-slices-ii-subsequence 451-sort-characters-by-frequency 452-minimum-number-of-arrows-to-bur...
LeetCode #1512. Number of Good Pairs 题目1512. Number of Good Pairs解题方法先构造计数字典,返回值rat,然后遍历字典根据其中每个数字的出现次数套用公式n(n-1)/2即可。 时间复杂度:O(n) 空间复杂度:O(n)代码class Solution: def numIdenticalPairs(self, nums: List[int]) -> int: dic, rat = coll...