max(ceil(sum(A) / 2), max(A))
This problem can be translated into...
Do as the game. Choose two heaviest stone and do the subtraction.
Use priority queue to find the largest k numbers. also and their index.
Maintain a Heap that contains only the K biggest the element.
First we need to sort the scores from biggest to smallest.
Calculate the building in lines not by the whole building.
找1~n中的完全平方数
First sort by value, then sort by lexicography.
The point of this problem is to find the most appearance of s[i] - d[i].
Check one by one.
The most important is to consider all the situations that doesn't make a peak.
This is bit XOR Operation.
If we combine the left search with the right search, we need to make the lines with shorter height move.