Maximum Score From Removing Stones LeetCode solution in Java
1class Solution {2public int maximumScore(int a, int b, int c) {3// Make sure a <= b <= c4if (a > b) return maximumScore(b, a, c);5if (b > c) return maximumScore(a, c, b);67// if sum of smallest numbers [a+b] is less than c, then we can a + b pairs with the c8if (a + b <= c) return a + b;910// if sum of smallest numbers is greater than c, then we can (a+b)/2 pairs after making c empty11return c + (a + b - c) / 2;12}13}