Given an array of stone weights, repeatedly smash the two heaviest stones. If x == y, both are destroyed. If x != y, the stone of weight y-x remains. Return the weight of the last stone.
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.