/*
* @lc app=leetcode.cn id=2475 lang=typescript
*
* [2475] 数组中不等三元组的数目
*/
// @lc code=start
function unequalTriplets(nums: number[]): number {}
// @lc code=end
function unequalTriplets(nums: number[]): number {
const n = nums.length
let res = 0
for (let i = 0; i < n; i++) {
for (let j = i + 1; j < n; j++) {
for (let k = j + 1; k < n; k++) {
if (new Set([nums[i], nums[j], nums[k]]).size === 3) {
res++
}
}
}
}
return res
}
test.each([
{ input: { nums: [4, 4, 2, 4, 3] }, output: 3 },
{ input: { nums: [1, 1, 1, 1, 1] }, output: 0 },
])('input: nums = $input.nums', ({ input: { nums }, output }) => {
expect(unequalTriplets(nums)).toEqual(output)
})