FastPrepFastPrep
Problem Brief

Maximize Efficiency with TikTok

INTERNOA
See Tiktok online assessment and hiring insights

In a futuristic TikTok research facility, engineers have discovered a mysterious algorithmic manuscript within the app that promises to revolutionize content creation and engagement for creators worldwide. This manuscript contains a sequence of numbers, represented as an array named efficiencyScores, which includes the efficiency scores of various TikTok tasks. These tasks can be highly efficient, neutral, or even counterproductive. The number of tasks is denoted by n. The manuscript has become the focal point of intense research, as it is believed to hold the key to unlocking unprecedented levels of audience engagement.

Your mission is to assist the engineers in their quest. According to the manuscript, by selecting exactly five tasks in a specific combination that maximizes the overall efficiency, the secret formula for viral content will be revealed.

Your goal is to identify this combination of five tasks that results in the highest possible product, thereby unlocking the potential hidden within the manuscript and advancing content creation science.

Formula: maximum_product = max(efficiencyScores[i1] * efficiencyScores[i2] * efficiencyScores[i3] * efficiencyScores[i4] * efficiencyScores[i5])

Function Description

Complete the function maximizeEfficiencyProduct in the editor below.

maximizeEfficiencyProduct has the following parameter(s):

  1. int efficiencyScores[n]: the efficiency scores of various tasks.

Returns

int: the highest possible product of any five selected efficiency scores.

1Example 1

Input
efficiencyScores = [6, 1, 2, 8, 1]
Output
96
Explanation
There are only 5 numbers in the array, we select all of them, and the product is 96.

Constraints

Limits and guarantees your solution can rely on.

  • 5 ≤ n ≤ 10^5.
  • -10^3 ≤ efficiencyScores[i] ≤ 10^3
public int maximizeEfficiencyProduct(int[] efficiencyScores) {
  // write your code here
}
Input

efficiencyScores

[6, 1, 2, 8, 1]

Output

96

Sign in to submit your solution.