➤ Problem Link : 1300B. Assigning to Classes
✅ C++ Solution :
#include<bits/stdc++.h> using namespace std; #define ll long long int int main() { int t; cin>>t; while(t--) { int n,x,v,u; cin>>n; ll arr[2*n]; for(int i=0;i<2*n;i++) { cin>>arr[i]; } sort(arr,arr+2*n); cout<<arr[n]-arr[n-1]<<"\n"; } }
Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook.
😇Happy Learning!!