Maximum Score From Removing Stones
You are playing a solitaire game with three piles of stones of sizes a, b, and c respectively. Each turn you choose two different non-empty piles, take one stone from each, and add 1 point to your score. The game stops when there are fewer than two non-empty piles, meaning there are no more available moves.
Given three integers a, b, and c, return the maximum score you can get.
Example 1
Input
a = 2, b = 4, c = 6Output
6The starting state is (2, 4, 6), and one optimal sequence removes stones for 6 turns until fewer than two piles are non-empty.
Example 2
Input
a = 4, b = 4, c = 6Output
7The starting state is (4, 4, 6), and one optimal sequence removes stones for 7 turns until all piles are empty.
Constraints
- 1 <= a, b, c <= 10^5