1354. Construct Target Array With Multiple Sums
Hard
Input: target = [9,3,5]
Output: true
Explanation: Start with arr = [1, 1, 1]
[1, 1, 1], sum = 3 choose index 1
[1, 3, 1], sum = 5 choose index 2
[1, 3, 5], sum = 9 choose index 0
[9, 3, 5] DoneInput: target = [1,1,1,2]
Output: false
Explanation: Impossible to create target array from [1,1,1,1].Time Complexity : O(N) + O(logM)*O(logN)
Last updated