Tallest Billboard
Problem statement
Partition any subset of rods into two groups with equal sums. Return the greatest possible common sum. A rod may be unused.
Function
tallestBillboard(rods: int[]) → intExamples
Example 1
rods = [1,2,3,6]return = 6Use 6 on one side and 1+2+3 on the other.
Example 2
rods = [1,2]return = 0No positive equal-height partition exists.
Constraints
1 <= rods.length <= 20.1 <= rods[i] <= 1000.- The total length is at most
5000.
Source note: Author-written prompt excerpt retained for source fidelity.