Question bank › Dynamic Programming
Dsa Dynamic Programming Easy

Maximizing Product Subset

You are given an array of integers. Your task is to find the maximum product obtainable from a non-empty subset of the array. If the array contains only negative numbers or is empty, the maximum product should be returned as 0. Input format: - The first line contains an integer n (1 <= n <= 100) representing the number of elements in the array. - The next line contains n integers (positive, negative, or zero) representing the elements of the array. Output format: - A single integer representing the maximum product from the subset. Example: Input: 5 2 -3 4 0 -1 Output: 8 (The maximum product is obtained from 2 and 4).

Key concepts

dynamic_programmingsubarray_problem

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.