updated value of i = max(j-1, 0)