1 of 2

Not sure why you incorporated j at all... You're getting this error because, when i == x.size(), and you try to get x[i], your index is indeed out of bounds. Even when i == x.size() - 1, you are referencing x[i+1] with the same issue. A more typical loop might be:

for (i = 1; i < x.size(); i++)
{
    Engage__c record1 = x[i-1];
    Engage__c record2 = x[i];
    // logic here
}