@@ -0,0 +1,949 @@
+// https://community.topcoder.com/stat?c=problem_statement&pm=5982%0A%0A// Optimization ideas:%0A// - average can directly be calculated by evaluating (times%5Btimes.length-1%5D / times.length)%0A// - no need for an extra array%0A// Better overall solution: https://github.com/charles-wangkai/topcoder/blob/master/SpeedTyper.java%0A%0Apublic class SpeedTyper %7B%0A%09public static String lettersToPractice(String letters, int%5B%5D times) %7B%0A%09%09int%5B%5D timeToPressKey = new int%5Btimes.length%5D;%0A%09%09timeToPressKey%5B0%5D = times%5B0%5D;%0A%09%09int sum = times%5B0%5D;%0A%09%09%0A%09%09for (int i = 1; i %3C times.length; ++i) %7B%0A%09%09%09timeToPressKey%5Bi%5D = (times%5Bi%5D - times%5Bi-1%5D);%0A%09%09%09sum += timeToPressKey%5Bi%5D;%0A%09%09%7D%0A%09%09%0A%09%09double average = (double) sum / times.length;%0A%09%09StringBuilder lettersToPractise = new StringBuilder();%0A%09%09%0A%09%09for (int i = 0; i %3C timeToPressKey.length; ++i) %7B%0A%09%09%09if (timeToPressKey%5Bi%5D %3E average) %7B%0A%09%09%09%09lettersToPractise.append(letters.charAt(i));%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09return lettersToPractise.toString();%0A%09%7D%0A%7D%0A

Create SpeedTyper.java