← All problemsSign in

2475. Number of Unequal Triplets in Array

LeetCodeArrayHash TableSortingOpen on judge ↗

You are given a 0-indexed array of positive integers nums. Find the number of triplets (i, j, k) that meet the following conditions: - 0 <= i < j < k < nums.length - nums[i], nums[j], and nums[k] are pairwise distinct. - In other words, nums[i] != nums[j], nums[i] != nums[k], and nums[j] != nums[k]. Return the number of triplets that meet the conditions. Example 1: Input: nums = [4,4,2,

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start