← Amazon questions

Magic balls collision

Filed under Amazon

Given a bag of balls with weights, repeatedly remove the two heaviest balls. If weights are unequal, add a new ball with weight |X-Y|. If equal, remove both. Return the final weight remaining, or 0 if…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.