You are viewing a single comment's thread. Return to all comments →
with your approach i am able to pass only 2 test cases, but with my code i am unable to pass only 4th test case,Suggest some changes or another approach.
Here is my code in C:
long int i,j,n;
long long int min,a[n];
Your approach is likely taking too long, since you're running O(n^2)
If you're using just the C stdlib, try using qsort on the data set and then comparing just the neighbors for each element.