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 Code
< ? php function minRadius ( $ k , $ x , $ y , $ n ) { $ dis = array ( ) ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ dis [ $ i ] = $ x [ $ i ] * $ x [ $ i ] + $ y [ $ i ] * $ y [ $ i ] ; sort ( $ dis ) ; return $ dis [ $ k - 1 ] ; } $ k = 3 ; $ x = array ( 1 , -1 , 1 ) ; $ y = array ( 1 , -1 , -1 ) ; $ n = count ( $ x ) ; echo minRadius ( $ k , $ x , $ y , $ n ) ; ? >