Solved LeetCode program · 808 of 1,000
#1046 · Last Stone Weight
Original English source
The stones is a list of 2, 7, 4, 1, 8, and 1.
Repeat while the number of items in stones is more than 1.
Sort stones. The heavy is the last item of stones. Remove the last item from stones. The light is the last item of stones. Remove the last item from stones. If heavy is not light, The rest is heavy minus light, Place rest into stones.
Show item 0 of stones.
Expected stdout
1