LeetCode #: 1167
Difficulty: Medium
Topics: Greedy.
The idea:
- Sort the sticks by length.
- Combine the shortest first and second sticks.
- Sum up the combined stick value.
- Put the combined stick into the sorted array of sticks (make sure to insert at the right position).
- Repeat until all sticks are combined into one.
The sum value is the answer.