题目地址:
https://leetcode.com/problems/count-the-number-of-good-subarrays/description/
给定一个长 n n n数组 a a a,对于其子数组 b b b,定义 f ( b ) = ∣ { ( i , j ) : i < j ∧ a i = a j } ∣ f(b)=|\{(i,j):i<j\land a_i=a_j\}| f(b)=∣{(i,j):i<j∧ai
https://leetcode.com/problems/count-the-number-of-good-subarrays/description/
给定一个长 n n n数组 a a a,对于其子数组 b b b,定义 f ( b ) = ∣ { ( i , j ) : i < j ∧ a i = a j } ∣ f(b)=|\{(i,j):i<j\land a_i=a_j\}| f(b)=∣{(i,j):i<j∧ai