The problem is to find the next word in the wordList.
So we can use the parent to represent grandparent.
Because the tasks have cooldown period, so we want the task with maximum occurrences do first.
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.