Skip to content

Practice Maximum Strength of a Group

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2708
LeetCode Problem

Maximum Strength of a Group

Problem Statement

You are given a 0-indexed integer array nums representing the score of students in an exam. The teacher would like to form one non-empty group of students with maximal strength, where the strength of a group of students of indices i0, i1, i2, ... , ik is defined as nums[i0] * nums[i1] * nums[i2] * ... * nums[ik​]. Return the maximum strength of a group the teacher can create.

Source: Maximum Strength of a Group on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [3,-1,-5,2,5,-9]
Output
1350

# Example 2

Input
nums = [-4,-5,-4]
Output
20

Constraints

1 <= nums.length <= 13
-9 <= nums[i] <= 9

Related LeetCode Problems

Practice more problems similar to Maximum Strength of a Group.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.