Skip to main content

One doc tagged with "priority-queue"

View all tags

Last Stone Weight

This question is asked by Amazon. You are given a group of stones, all of which have a positive weight. At each turn, we select the heaviest two stones and smash them together. When smashing these two stones together, one of two things can happen: