@@ -0,0 +1,649 @@
+// https://community.topcoder.com/stat?c=problem_statement&pm=14295%0A%0Aimport java.util.Deque;%0Aimport java.util.ArrayDeque;%0A%0Apublic class PriorityQueue %7B%0A%09public static int findAnnoyance(String S, int%5B%5D a) %7B%0A%09%09Deque%3CInteger%3E canteenQueue = new ArrayDeque%3CInteger%3E();%0A%09%09int totalDispleasure = 0;%0A%09%09%0A%09%09for (int i = 0; i %3C S.length(); ++i) %7B%0A%09%09%09char currentChar = S.charAt(i);%0A%09%09%09%0A%09%09%09if (currentChar == 'b') %7B%0A%09%09%09%09for (Integer cutoffChildIndex : canteenQueue) %7B%0A%09%09%09%09%09totalDispleasure += a%5BcutoffChildIndex%5D;%0A%09%09%09%09%7D%0A%09%09%09%09canteenQueue.addFirst(i);%0A%09%09%09%7D%0A%09%09%09else %7B // currentChar == 'e'%0A%09%09%09%09canteenQueue.addLast(i);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09return totalDispleasure;%0A%09%7D%0A%7D%0A

Create PriorityQueue.java