1.

max = 0;
vector<int>::iterator iter = begin(a);
while (iter != end(a)) {
iter = adjacent_find(iter, end(a)-1, [&max](int a, int b) {
if (b - a > max) 
max = b - a;
return b - a;
});
iter++;
}



2.

max = 0;

for (int i = 0; i < N - 1; i++) {

if (A[i] - A[i + 1] > max)

max = A[i] - A[i + 1];

}