Minimum Moves to Equal Candy Bars

Problem Overview

  • Core task: given counts A, B, C of three candy types, find the minimum moves to make all candies the same taste by converting any two different types into the third.
  • Input/Output: read A, B, C; print the minimum moves, or -1 if not possible.
  • Constraints: 1 <= A, B, C <= 1e8.
  • Context: models balancing conversions among candy flavors.
  • From Walmart interviews; a coding interview problem and common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: