We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Minimum Absolute Difference in an Array
Minimum Absolute Difference in an Array
Sort by
recency
|
697 Discussions
|
Please Login in order to post a comment
Here is my solution for this (C++)
include
define ll long long
define minimize(a,b) a=min(a,b)
const ll MOD = (ll) 1e18+3; using namespace std; ll n,a[100001],ans=1e9+1; void fastip(){ ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); }
int main(){ fastip(); cin>> n; for (int i=0;i>a[i]; } sort(a,a+n); for (int i=1;i
Here is my c++ solution, you can find the explanation here : https://youtu.be/6SnD7A1TbJQ