The TransCompilator

Solved LeetCode program · 808 of 1,000

#1046 · Last Stone Weight

Easy Array chunk-17.md

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.

Open in Playground Browse all 1,000 problems

Expected stdout

1