@@ -0,0 +1,990 @@
+// https://community.topcoder.com/stat?c=problem_statement&pm=2924%0A%0Apublic class MovingAverages %7B%0A%09public static int%5B%5D calculate(String%5B%5D times, int n) %7B%0A%09%09int%5B%5D movingAverages = new int%5Btimes.length - n + 1%5D;%0A%09%09%0A%09%09// Calculate average of elements ranging from times%5BstartIndex%5D to times%5BendIndex%5D%0A%09%09int i = 0;%0A%09%09for (int startIndex = 0, endIndex = n-1; %0A%09%09%09 endIndex %3C times.length; %0A%09%09%09 ++startIndex, ++endIndex) %0A%09%09%7B%0A%09%09%09int sumOfTime = 0;%09// sum of time in current range%0A%09%09%09int timeCount = 0;%09// number of elements in current range%0A%09%09%09for (int j = startIndex; j %3C= endIndex; ++j) %7B%0A%09%09%09%09int timeInSeconds =%0A%09%09%09%09%09%09( Integer.parseInt(times%5Bj%5D.substring(0, 2)) * 3600 ) + // hours (in seconds)%0A%09%09%09%09%09%09( Integer.parseInt(times%5Bj%5D.substring(3, 5)) * 60 ) +%09// minutes (in seconds)%0A%09%09%09%09%09%09( Integer.parseInt(times%5Bj%5D.substring(6, 8)) );%09%09%09// seconds%0A%09%09%09%09sumOfTime += timeInSeconds;%0A%09%09%09%09timeCount++;%0A%09%09%09%7D%0A%09%09%09movingAverages%5Bi%5D = (sumOfTime / timeCount);%0A%09%09%09i++;%0A%09%09%7D%0A%09%0A%09%09return movingAverages;%0A%09%7D%0A%7D%0A

Create MovingAverages.java