Skip to content

Practice Maximum Score From Removing Stones

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#1753
LeetCode Problem

Maximum Score From Removing Stones

Problem Statement

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.

Source: Maximum Score From Removing Stones on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
a = 2, b = 4, c = 6
Output
6

# Example 2

Input
a = 4, b = 4, c = 6
Output
7

# Example 3

Input
a = 1, b = 8, c = 8
Output
8

Constraints

1 <= a, b, c <= 10^5

Related LeetCode Problems

Practice more problems similar to Maximum Score From Removing Stones.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.