Counting Triangles
Practice
3.8 (38 votes)
Approved
Binary search
Data structures
Easy
Hash maps
Hashing algorithm
Open
Sorting
Problem
56% Success 13294 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

You are given n triangles.

You are required to find how many triangles are unique out of given triangles. For each triangle you are given three integers a,b,c , the sides of a triangle.

A triangle is said to be unique if there is no other triangle with same set of sides.

Note : It is always possible to form triangle with given sides.

INPUT:

First line contains n, the number of triangles. Each of next n lines contain three integers a,b,c (sides of a triangle).

Output:

print single integer, the number of unique triangles.

Constraints:

1 <= n <= 10^5
1 <= a,b,c <= 10^15

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
62 votes
Tags:
Basic ProgrammingBinary SearchEasySearchingapproved
Points:20
38 votes
Tags:
AlgorithmsBasic ProgrammingBinary SearchEasySearchingString Manipulation
Points:20
200 votes
Tags:
ApprovedBinary SearchEasyOpenSorting