TCS OA-16 2024
Problem Description
In a company, the efficiency of each employee is represented by an integer value in the array arr
. The efficiencies can be positive, negative, or zero. Your task is to find the maximum possible efficiency that can be achieved by selecting any three employees. The efficiency of the selected three employees will be calculated by multiplying their individual efficiencies.
Input Format
- The first line contains an integer N, representing the array's length.
- The second line contains N space-separated integers.
Output Format
Print the maximum efficiency of 3 employees.
Constraints
- 1 ≤ arr.size() ≤ 100
- -10³ ≤ arr[i] ≤ 10³
Example
Sample Input:
5
[4, -3, -9, 5, 2]
Sample Output:
135
Explanation:
The maximum efficiency of 3 employees is -3 * -9 * 5 = 135.