Minimum Cost to Connect Sticks (Huffman)
Medium · Greedy · about 15 minutes
You have sticks with positive integer lengths. Connecting two sticks of lengths x and y costs x + y and produces one stick of length x + y. Return the minimum total cost to connect all the sticks into one.