Skip to content

Commit ca7e4e0

Browse files
committed
Create 2475-NumberOfUnequalTripletsInArray.cpp
1 parent 797881c commit ca7e4e0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
int unequalTriplets(vector<int>& nums) {
4+
int cnt(0);
5+
for(int p = 0; p < nums.size(); p++){
6+
for(int q = p + 1; q < nums.size(); q++){
7+
for(int r = q + 1; r < nums.size(); r++){
8+
cnt += (nums[p] != nums[q] && nums[q] != nums[r] && nums[r] != nums[p]);
9+
}
10+
}
11+
}
12+
13+
return cnt;
14+
}
15+
};

0 commit comments

Comments
 (0)