1354. Construct Target Array With Multiple Sums
https://leetcode.com/problems/construct-target-array-with-multiple-sums
Description
You are given an array target
of n integers. From a starting array arr
consisting of n
1's, you may perform the following procedure :
let
x
be the sum of all elements currently in your array.choose index
i
, such that0 <= i < n
and set the value ofarr
at indexi
tox
.You may repeat this procedure as many times as needed.
Return true
if it is possible to construct the target
array from arr
, otherwise, return false
.
Example 1:
Example 2:
Example 3:
Constraints:
n == target.length
1 <= n <= 5 * 104
1 <= target[i] <= 109
ac
Last updated