Company: Walmart
Difficulty: easy
Candy Taste Equalization You have candies of three different tastes: A candies of type 1, B candies of type 2, and C candies of type 3. You may perform the following operation any number of times (possibly zero): Choose any two candies of two different tastes. Both of them turn into candies of the remaining taste. For example, if you pick one candy of type 1 and one candy of type 2, they both become candies of type 3: the counts change from (A, B, C) to (A - 1, B - 1, C + 2) . Your goal is to make all candies you hold share the same taste. Return the minimum number of operations needed to reach that goal, or -1 if it is impossible. Input Format The first line contains three space-separated integers: the number of candies of type 1 ( A ), the number of candies of type 2 ( B ), and the number of candies of type 3 ( C ). Output Format Print a single integer n , the minimum number of moves required if the goal is achievable. If the goal is not achievable, print -1 . Constraints 1 <= A,