Find if slope is good with only two intercept
static bool isSlopeGood ( double slope , int [ ] arr , int n ) { HashSet < Double > setOfLines = new HashSet < Double > ( ) ; for ( int i = 0 ; i < n ; i ++ ) setOfLines . Add ( arr [ i ] - slope * ( i ) ) ;