You are given an integer array
planks, whereplanks[i]represents the height of thei^thwooden plank. Each plank has a width of 1 unit.You want to build a fence consisting of planks that all have the same height.
You may either use a plank as is, or combine exactly two distinct original planks into a single plank whose height equals the sum of their heights. Each original plank can be used at most once, and not all original planks need to be used.
Return the maximum possible width of the fence that can be built.
1 |
|