intbinarySearch(vector<int> array){ int l = 0, r = array.size() - 1, res = INT_MAX; while(l <= r) { int m = (l + r) / 2; if(array[m] == m) res = min(res, m);
if(array[m] >= m) r = m - 1; else l = m + 1; } return res == INT_MAX ? -1 : res; }
intiterationSearch(vector<int> array){ for(int i = 0; i < array.size(); i++) if(i == array[i]) return i; return-1; }