My issue
Solve
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
}
Problem Link: Asymmetric Swaps Practice Coding Problem
Solve
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
}
Problem Link: Asymmetric Swaps Practice Coding Problem
int n;
cin>>n;
int A[2*n];
for(int i=0;i<2*n;i++)cin>>A[i];
sort(A,A+2*n);
int min= A[n]-A[0];
for(int i=0;i<=n;i++){
if(A[n-1+i]-A[i] <min)min=A[n-1+i]-A[i];
}
cout<<min<<endl;