feat: new greedy problem formated

This commit is contained in:
2026-02-05 23:10:20 -03:00
parent 0f4e453c07
commit a3f93d2e59
143 changed files with 859320 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
#include <bits/stdc++.h>
using namespace std;
int main(){
int t; cin >> t;
while (t--) {
int n; cin >> n;
vector<int> nums(n);
for (int i = 0; i < n; i++) cin >> nums[i];
sort(nums.begin(), nums.end());
int minDiff = INT_MAX;
for (int i = 1; i < n; i++) {
minDiff = min(minDiff, nums[i] - nums[i - 1]);
}
cout << minDiff << endl;
}
return 0;
}