Find minimum radius such that atleast k point lie inside the circle | Return minimum distance required so that aleast k point lie inside the circle . ; Finding distance between of each point from origin ; Sorting the distance ; driver function
function minRadius ( k , x , y , n ) { let dis = Array . from ( { length : n } , ( _ , i ) => 0 ) ; for ( let i = 0 ; i < n ; i ++ ) dis [ i ] = x [ i ] * x [ i ] + y [ i ] * y [ i ] ; dis . sort ( ) ; return dis [ k - 1 ] ; } let k = 3 ; let x = [ 1 , - 1 , 1 ] ; let y = [ 1 , - 1 , - 1 ] ; let n = x . length ; document . write ( minRadius ( k , x , y , n ) ) ;