Computer Science, asked by shalihatome, 9 months ago

find the number of all triplets in the array that can form a triangle (condition is a+b>c)

Answers

Answered by nightfury27
0

Explanation:

Square every element in the input array and then sort it in ascending order. Since the array now contains squares, the new equation for triplet becomes a = b + c a = b + c a=b+c. Fix a to be the last element of this sorted array, since a will always have the largest value of the three numbers

Similar questions