1. You are given an array of positive integers.
2. You have to find the number of triangles that can be formed with three different array elements as three sides of triangles.
3. For example,
Input: {4, 6, 3, 7}
Output: 3
Explanation: There are three triangles possible {3, 4, 6}, {4, 6, 7} and {3, 6, 7}. Note that {3, 4, 7} is not a possible triangle.
Note:
1. main takes input from the users.
2. display is a utility function that displays an array. Feel free to use it for debugging purposes.
3. This is a functional problem.
4. You have to complete the function count. It takes as input the given array. It should return the required count.Input Format
First line takes input N, the length of the given array. Second line takes input N space separated integers representing the elements of the array. Input is handled for you.
Output Format
The required count. Output is handled for you.
Constraints
N/A
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
4 4 6 3 7
Output
3