You are viewing a single comment's thread. Return to all comments →
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.
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Absolute Difference in an Array
You are viewing a single comment's thread. Return to all comments →
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.