func_code_string: #include <bits/stdc++.h>   using namespace std;   int arr[300022];   int main() {     int q;     scanf( %d , &q);     while (q--) {       int n, i;       scanf( %d , &n);       for (i = 0; i < n; i++) scanf( %d , &arr[i]);       map<int, int> mf, ml;       map<int, int>::iterator it;       for (i = 0; i < n; i++) {         if (mf.find(arr[i]) == mf.end()) mf[arr[i]] = i;         ml[arr[i]] = i;       }       int ans = 0, in = -1, len = 0;       int cou = 0;       for (it = mf.begin(); it != mf.end(); it++) {         cou++;         int ele = it->first;         int focc = it->second, locc = ml[ele];         if (focc > in)           len++;         else           len = 1;         in = locc;         ans = max(ans, len);       }       cout << (cou - ans) << endl;     }     return 0;   }   