Please guyes help me to finding the all possilbe triplets of an array with below constraints
suppose given array is arr with n elements with some repeating elements but each element may occur atmost 2 times.
arr[i] < arr[j] < arr[k] for any i < j < k.
i have solved this problem in O(n*n) time complexity but not getting more optimized solution so please help me.
6 1 2 3 1 2 4 o/p = 4;