Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- int t;
- cin>>t;
- while (t--){
- int n;
- cin >> n;
- vector<int> x(n);
- for(int i = 0; i < n; i++) cin >> x[i];
- int count = 1e9;
- for(int i = 1; i < n; i++){
- count = min(count, max(x[i], x[i - 1]) - 1);
- }
- cout << count << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment