Problem · Array

Maximize Efficiency with TikTok

Learn this problem
EasyTiktokINTERNOA
See Tiktok hiring insights

Problem statement

Given an integer array efficiencyScores, select exactly five elements and return the largest possible product of the selected values.

The five elements must come from distinct array positions. Their original order does not matter.

The function maximizeEfficiencyProduct receives efficiencyScores, the efficiency scores of the available tasks, and returns the maximum product as a long.

Function

maximizeEfficiencyProduct(efficiencyScores: int[]) → long

Examples

Example 1

efficiencyScores = [6, 1, 2, 8, 1]return = 96

There are exactly five values, so all of them must be selected. Their product is 96.

Constraints

  • 5 <= efficiencyScores.length <= 10^5
  • -10^3 <= efficiencyScores[i] <= 10^3

More Tiktok problems

drafts saved locally
public long maximizeEfficiencyProduct(int[] efficiencyScores) {
  // Write your code here.
}
efficiencyScores[6, 1, 2, 8, 1]
expected96
checking account