text: Minimum number of points to be removed to get remaining points on one side of axis | Function to find the minimum number of points ; Number of points on the left of Y - axis . ; Number of points on the right of Y - axis . ; Number of points above X - axis . ; Number of points below X - axis . ; Driver Code
code: function findmin ( p , n ) { let a = 0 , b = 0 , c = 0 , d = 0 ; for ( let i = 0 ; i < n ; i ++ ) { if ( p [ i ] [ 0 ] <= 0 ) a ++ ; else if ( p [ i ] [ 0 ] >= 0 ) b ++ ; if ( p [ i ] [ 1 ] >= 0 ) c ++ ; else if ( p [ i ] [ 1 ] <= 0 ) d ++ ; } return Math . min ( Math . min ( a , b ) , Math . min ( c , d ) ) ; } let p = [ [ 1 , 1 ] , [ 2 , 2 ] , [ - 1 , - 1 ] , [ - 2 , 2 ] ] let n = p . length ; document . write ( findmin ( p , n ) ) ;