Task: Given an array of distinct elements, Find the number of triplets. Triplet means two elements sum is equals to third element. Example: Input: 1 4 1 5 3 2 Output: 2 // 1 + 2 = 3 and 2 + 3 = 5. Here is the Code: Program in C++: #include<iostream> #include<bits/stdc++.h> int countTheTriplets(int *a,int n) { sort(a,a+n); //1 2 3 5 int j,k,c=0; for(int i=0;i<n-2;i++) { j=i+1; k=j+1; while(k<n) { if(a[i]+a[j]==a[k]) { c++; j++; //k--; } else if(a[i]+a[j]<a[k]...