Skip to content

Practice Construct Target Array With Multiple Sums

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

Hard#1354
LeetCode Problem

Construct Target Array With Multiple Sums

Problem Statement

Begin with an array of target.length entries, all equal to 1. In one operation, compute the current sum of the entire array and replace one chosen entry by that sum. Return whether repeated operations can produce target exactly; zero operations are allowed.

Source: Construct Target Array With Multiple Sums on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
target = [9,3,5]
Output
true

# Example 2

Input
target = [1,1,1,2]
Output
false

# Example 3

Input
target = [8,5]
Output
true

Constraints

n == target.length
1 <= n <= 5 * 10^4
1 <= target[i] <= 10^9

Related LeetCode Problems

Practice more problems similar to Construct Target Array With Multiple Sums.

Review your practice with PhantomCodeAI

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