Tag Archives: triangle

Possible to form a triangle from array values

Given an array of integers, we need to find out whether it is possible to construct at least one non-degenerate triangle using array values as its sides. In other words, we need to find out 3 such array indices which can become sides of a non-degenerate triangle. Examples: Input : [4, 1, 2] Output :… Read More »

Classify a triangle

We are given co-ordinates of a triangle. The task is to classify this triangle on basis of sides and angle. Examples: Input : p1 = (3, 0), p2 = (0, 4), p3 = (4, 7) Output : Right Angle triangle and Isosceles Input : p1 = (0, 0), p2 = (1, 1), p3 = (1,… Read More »

Area of a polygon with given n ordered vertices

Given ordered coordinates of a polygon with n vertices. Find area of the polygon. Here ordered mean that the coordinates are given either in clockwise manner or anticlockwise from first vertex to last. Examples: Input : X[] = {0, 4, 4, 0}, Y[] = {0, 0, 4, 4}; Output : 16 Input : X[] =… Read More »