@@ -0,0 +1,718 @@
+// https://community.topcoder.com/stat?c=problem_statement&pm=13195%0A%0Apublic class CostOfDancing %7B%0A%09public int minimum(int K, int%5B%5D danceCost) %7B%0A%09%09// Sort array via Bubble Sort - max elements is 1000, so the sorting algorithm doesn't matter%0A%09%09boolean stillSwapping = true;%0A%09%09while (stillSwapping) %7B%0A%09%09%09stillSwapping = false;%0A%09%09%09for (int i = 0; i %3C danceCost.length-1; ++i) %7B%0A%09%09%09%09if (danceCost%5Bi%5D %3E danceCost%5Bi+1%5D) %7B%0A%09%09%09%09%09int temp = danceCost%5Bi%5D;%0A%09%09%09%09%09danceCost%5Bi%5D = danceCost%5Bi+1%5D;%0A%09%09%09%09%09danceCost%5Bi+1%5D = temp;%0A%09%09%09%09%09stillSwapping = true;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09// Calculate smallest total cost for K courses%0A%09%09int minimumCost = 0;%0A%09%09for (int i = 0; i %3C K; ++i) %7B%0A%09%09%09minimumCost += danceCost%5Bi%5D;%0A%09%09%7D%0A%09%09return minimumCost;%0A%09%7D%0A%7D%0A

Create CostOfDancing.java