Tap here to switch tabs
Problem
Submissions

Problem: Widest Possible Fence

med
30 min
Try to solve the Widest Possible Fence problem.

Statement

You are given an integer array planks, where each element represents the length of a plank.

You want to build a fence consisting of planks that all have the exact same length. To construct each plank for the fence, you may:

  • Use 11 original plank from planks.

  • Combine 22 distinct original planks from planks, resulting in a plank whose length is the sum of their individual lengths.

Each original plank in planks can be used at most 11 time.

Return the maximum number of equal length planks you can form.

Note: You do not need to use all the original planks from planks.

Constraints:

  • 1≤1 \leq planks.length ≤1000\leq 1000

  • 1≤1 \leq planks[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Widest Possible Fence

med
30 min
Try to solve the Widest Possible Fence problem.

Statement

You are given an integer array planks, where each element represents the length of a plank.

You want to build a fence consisting of planks that all have the exact same length. To construct each plank for the fence, you may:

  • Use 11 original plank from planks.

  • Combine 22 distinct original planks from planks, resulting in a plank whose length is the sum of their individual lengths.

Each original plank in planks can be used at most 11 time.

Return the maximum number of equal length planks you can form.

Note: You do not need to use all the original planks from planks.

Constraints:

  • 1≤1 \leq planks.length ≤1000\leq 1000

  • 1≤1 \leq planks[i] ≤109\leq 10^9