May 12, 2022 |650 Views

    Count number of unique Triangles using STL

      Share   Like
    Description
    Discussion

    We are given n triangles along with length of their three sides as a,b,c. Now we need to count number of unique triangles out of these n given triangles. Two triangles are different from one another if they have at least one of the sides different.

    Since we are asked to find number of “unique” triangles, we can use either set or unordered_set. In this post, set based approach is discussed.
    How to store three sides as an element in the container? We use STL pair to store all the three sides together as

    Count number of unique Triangles using STL:  https://www.geeksforgeeks.org/count-number-of-unique-triangles-using-stl/