Given an array of distinct elements, you can choose any subset from the array and reorder them. You can place following operators between them: +, -, *, /, (, ) and evaluate the value of the expression. Your task is to find the minimum positive number which cannot be formed using the array elements. You can use the elements of an array only once for an expression.
Example 1:
Input: [1, 2]
Output: 4
Explanation:
1 and 2 are already present in the array.
You can make 3 by adding 1 and 2 i.e. 3 = 1+2
There no possible way to make 4.
Example 2:
Input: [1,2,3]
Output: 10
Can someone help with the optimized approach for this question?