Given three sides of the triangle, find the minimum increase in the length of the side of the triangle to make the area of the triangle non-negative.
Input: a = 3, b = 4, c = 10
With the given sides, the area is negative.
If a is increased to 5 and b to 5, then the area becomes 0, which is not negative.
Input: a = 6, b = 6, c = 10
Approach: Since the area of any triangle is non-negative if the sum of the smallest two sides is always greater than or equal to the third side, hence the following steps should be followed to solve the above problem:
- Sort the three sides in increasing order.
- Check if the sum of the first two sides is greater than or equal to the third side, if it is, then the answer is 0.
- If it is not, then the answer will be (third side – (first side + second side)).
Below is the implementation of the given approach.
- Find subarray with given sum | Set 1 (Nonnegative Numbers)
- Minimum increment or decrement operations required to make the array sorted
- Minimum increment or decrement required to sort the array | Top-down Approach
- Minimum count of increment of K size subarrays required to form a given Array
- Minimum increment/decrement operations required to make Median as X
- Minimum increment/decrement operations required on Array to satisfy given conditions
- Count of minimum reductions required to get the required sum K
- Maximum area rectangle by picking four sides from array
- Minimum side of square embedded in Regular polygon with N sides
- Minimum number of increment/decrement operations such that array contains all elements from 1 to N
- Minimum number of increment-other operations to make all array elements equal.
- Minimum increment by k operations to make all elements equal
- Making elements of two arrays same with minimum increment/decrement
- Minimum increment operations to make the array in increasing order
- Minimum Increment / decrement to make array elements equal
- Minimum range increment operations to Sort an array
- Minimum increment operations to make K elements equal
- Minimum Increment operations to make Array unique
- Minimum concatenation required to get strictly LIS for the given array
- Minimum concatenation required to get strictly LIS for array with repetitive elements | Set-2