leetcode.cn 2025-04-15
🔴2179.count-good-triplets-in-an-array
🏷️ Tags
#binary_indexed_tree #segment_tree #array #binary_search #divide_and_conquer #ordered_set #merge_sort
🔴2179.count-good-triplets-in-an-array
🏷️ Tags
#binary_indexed_tree #segment_tree #array #binary_search #divide_and_conquer #ordered_set #merge_sort
Telegraph
count-good-triplets-in-an-array
给你两个下标从 0 开始且长度为 n 的整数数组 nums1 和 nums2 ,两者都是 [0, 1, ..., n - 1] 的 排列 。 好三元组 指的是 3 个 互不相同 的值,且它们在数组 nums1 和 nums2 中出现顺序保持一致。换句话说,如果我们将 pos1v 记为值 v 在 nums1 中出现的位置,pos2v 为值 v 在 nums2 中的位置,那么一个好三元组定义为 0 <= x, y, z <= n - 1 ,且 pos1x < pos1y < pos1z 和 pos2x < pos2y…
leetcode.com 2025-04-15
🔴2179.count-good-triplets-in-an-array
🏷️ Tags
#binary_indexed_tree #segment_tree #array #binary_search #divide_and_conquer #ordered_set #merge_sort
🔴2179.count-good-triplets-in-an-array
🏷️ Tags
#binary_indexed_tree #segment_tree #array #binary_search #divide_and_conquer #ordered_set #merge_sort
Telegraph
count-good-triplets-in-an-array
You are given two 0-indexed arrays nums1 and nums2 of length n, both of which are permutations of [0, 1, ..., n - 1]. A good triplet is a set of 3 distinct values which are present in increasing order by position both in nums1 and nums2. In other words, if…
👍1
leetcode.cn 2025-04-16
🟡2537.count-the-number-of-good-subarrays
🏷️ Tags
#array #hash_table #sliding_window
🟡2537.count-the-number-of-good-subarrays
🏷️ Tags
#array #hash_table #sliding_window
Telegraph
count-the-number-of-good-subarrays
给你一个整数数组 nums 和一个整数 k ,请你返回 nums 中 好 子数组的数目。 一个子数组 arr 如果有 至少 k 对下标 (i, j) 满足 i < j 且 arr[i] == arr[j] ,那么称它是一个 好 子数组。 子数组 是原数组中一段连续 非空 的元素序列。 示例 1: 输入:nums = [1,1,1,1,1], k = 10 输出:1 解释:唯一的好子数组是这个数组本身。 示例 2: 输入:nums = [3,1,4,3,2,2,4], k = 2 输出:4 解释:总共有…
leetcode.cn 2025-04-19
🟡2563.count-the-number-of-fair-pairs
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟡2563.count-the-number-of-fair-pairs
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
count-the-number-of-fair-pairs
给你一个下标从 0 开始、长度为 n 的整数数组 nums ,和两个整数 lower 和 upper ,返回 公平数对的数目 。 如果 (i, j) 数对满足以下情况,则认为它是一个 公平数对 :
leetcode.cn 2025-04-22
🔴2338.count-the-number-of-ideal-arrays
🏷️ Tags
#math #dynamic_programming #combinatorics #number_theory
🔴2338.count-the-number-of-ideal-arrays
🏷️ Tags
#math #dynamic_programming #combinatorics #number_theory
Telegraph
count-the-number-of-ideal-arrays
给你两个整数 n 和 maxValue ,用于描述一个 理想数组 。 对于下标从 0 开始、长度为 n 的整数数组 arr ,如果满足以下条件,则认为该数组是一个 理想数组 :
leetcode.com 2025-04-22
🔴2338.count-the-number-of-ideal-arrays
🏷️ Tags
#math #dynamic_programming #combinatorics #number_theory
🔴2338.count-the-number-of-ideal-arrays
🏷️ Tags
#math #dynamic_programming #combinatorics #number_theory
Telegraph
count-the-number-of-ideal-arrays
You are given two integers n and maxValue, which are used to describe an ideal array. A 0-indexed integer array arr of length n is considered ideal if the following conditions hold: