Checks if ( i , j ) is valid , a point ( i , j ) is valid if point ( arr [ i ] , arr [ j ] ) satisfies the equation y = mx + c And i is not equal to j
static boolean isValid ( int [ ] arr , int i , int j , int m , int c ) {