You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel support must be an equal height.
You are given a collection of rods
that can be welded together. For example, if you have rods of lengths 1
, 2
, and 3
, you can weld them together to make a support of length 6
.
Return the largest possible height of your billboard installation. If you cannot support the billboard, return 0
.
Example 1:
Example 2:
Example 3:
Constraints:
rods.length
<= 20rods[i]
<= 1000sum(rods[i])
<= 5000寫得很隨便,沒優化
Yen-Chi ChenSat, Jun 24, 2023
Jerry Wu24 June, 2023