Minimum increment in the sides required to get non | Javascript Program to find Minimum increment in the sides required to get non - negative area of a triangle ; push the three sides to a array ; sort the array ; check if sum is greater than third side ; Driver Code
function minimumIncrease ( a , b , c ) { var arr = [ a , b , c ] ; arr . sort ( ( a , b ) => a - b ) ; if ( arr [ 0 ] + arr [ 1 ] >= arr [ 2 ] ) return 0 ; else return arr [ 2 ] - ( arr [ 0 ] + arr [ 1 ] ) ; } var a = 3 , b = 5 , c = 10 ; document . write ( minimumIncrease ( a , b , c ) ) ;