Tap here to switch tabs
Problem
Submissions

Problem: Number of Unequal Triplets in Array

med
30 min
Try to solve the Number of Unequal Triplets in Array problem.

Statement

You are given a 00 indexed array of positive integers nums.

Find the total number of index triplets (i, j, k) that satisfy all of the following conditions:

  • 0≤i<j<k<0 \leq i < j < k < nums.length

  • nums[i] \neq nums[j]

  • nums[i] \neq nums[k]

  • nums[j] \neq nums[k]

Return the total count of such valid triplets.

Constraints:

  • 3≤3 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Unequal Triplets in Array

med
30 min
Try to solve the Number of Unequal Triplets in Array problem.

Statement

You are given a 00 indexed array of positive integers nums.

Find the total number of index triplets (i, j, k) that satisfy all of the following conditions:

  • 0≤i<j<k<0 \leq i < j < k < nums.length

  • nums[i] \neq nums[j]

  • nums[i] \neq nums[k]

  • nums[j] \neq nums[k]

Return the total count of such valid triplets.

Constraints:

  • 3≤3 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤1000\leq 1000