Skip to content

Instantly share code, notes, and snippets.

@estelabn
Created September 26, 2023 23:37
Show Gist options
  • Save estelabn/cc8b58b221100e00df6d44ff85b05f22 to your computer and use it in GitHub Desktop.
Save estelabn/cc8b58b221100e00df6d44ff85b05f22 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main(){
int N; cin >> N;
int anterior = 0;
int menorDif = 1e9;
for(int i=0; i<N; i++){
int A; cin >> A;
if(i != 0) {
if((A-anterior) < menorDif) menorDif = (A-anterior);
}
anterior = A;
}
cout << menorDif << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment