Driver Code
let A = [ { first : 1 , second : 3 } , { first : 2 , second : 4 } , { first : 2 , second : 10 } , { first : 2 , second : 3 } , { first : 1 , second : 1 } ] ; let X = { first : 1 , second : 10 } ; document . write ( minimizeSegment ( A , X ) ) ;