# PROBLEM LINK:

* Author:* Setter’s name

*Editorialist’s name*

**Editorialist:**# DIFFICULTY:

CAKEWALK

# PREREQUISITES:

None

# PROBLEM:

Vedant has created an online multiplayer game and casually uploaded it on the Play store. His budget was low and so he used his pc as a server. After a few months on the Play store, the game suddenly rose in popularity, his pc cannot handle this sudden increase in load, and to keep up with the increasing user base, he decided to rent some servers for his game. His game was built to work on a single server but now he needs to use multiple servers. So Vedant made a list of number of ports each server can have and now he needs to find a triplet of three servers such that the total no of ways he can connect servers in parallel is maximum.

You are given an integer N denoting the length of the array and N space separated array of integers Ai denoting no of ports on ith server.You need to find triplet of server such that total number of parallel connections is maximum.

Note! parallel connection is connection in which one port of first server is connected to port of second server and same port is connected to port of third server.

# EXPLANATION:

All we have to do in this problem is find three maximum numbers in the given array and multiply them to get the answer. For this we can simply sort the given array and get the three largest integers.

# SOLUTIONS:

## Setter's Solution

```
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
long long int n;
cin>>n;
long long int arr[n];
for(int i=0;i<n;i++) cin>>arr[i];
sort(arr, arr+n);
cout<<max(arr[n-1]*arr[n-2]*arr[n-3], arr[0]*arr[1]*arr[n-1])<<endl;
}
return 0;
}
```