@@ -0,0 +1,1595 @@
+// https://community.topcoder.com/stat?c=problem_statement&pm=13462%0A%0Apublic class Target %7B%0A%09public static String%5B%5D draw(int n) %7B%0A%09%09char%5B%5D%5B%5D drawingMatrix = new char%5Bn%5D%5Bn%5D;%0A%09%09String%5B%5D drawing = new String%5Bn%5D;%0A%09%09%0A%09%09// Fill matrix with spaces beforehand%0A%09%09for (int i = 0; i %3C n; ++i) %7B%0A%09%09%09for (int j = 0; j %3C n; ++j) %7B%0A%09%09%09%09drawingMatrix%5Bi%5D%5Bj%5D = ' ';%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09int rowIndex = 0;%0A%09%09int colIndex = 0;%0A%09%09int minRowIndex = 0;%0A%09%09int minColIndex = 0;%0A%09%09int maxRowIndex = n-1;%0A%09%09int maxColIndex = n-1;%0A%09%09%0A%09%09// Fill matrix with '#' where needed%0A%09%09int loopCount = 0;%0A%09%09while (loopCount %3C n) %7B%0A%09%09%09// Fill row from left to right (%E2%86%92)%0A%09%09%09while (colIndex %3C= maxColIndex) %7B%0A%09%09%09%09drawingMatrix%5BrowIndex%5D%5BcolIndex%5D = '#';%0A%09%09%09%09colIndex++;%0A%09%09%09%7D colIndex--;%0A%09%09%09%0A%09%09%09// Fill column from top to bottom (%E2%86%93)%0A%09%09%09while (rowIndex %3C= maxRowIndex) %7B%0A%09%09%09%09drawingMatrix%5BrowIndex%5D%5BcolIndex%5D = '#';%0A%09%09%09%09rowIndex++;%0A%09%09%09%7D rowIndex--;%0A%09%09%09%0A%09%09%09// Fill row from right to left (%E2%86%90)%0A%09%09%09while (colIndex %3E= minColIndex) %7B%0A%09%09%09%09drawingMatrix%5BrowIndex%5D%5BcolIndex%5D = '#';%0A%09%09%09%09colIndex--;%0A%09%09%09%7D colIndex++;%0A%09%09%09%0A%09%09%09// Fill column from bottom to top (%E2%86%91)%0A%09%09%09while (rowIndex %3E= minRowIndex) %7B%0A%09%09%09%09drawingMatrix%5BrowIndex%5D%5BcolIndex%5D = '#';%0A%09%09%09%09rowIndex--;%0A%09%09%09%7D rowIndex++;%0A%09%09%09%0A%09%09%09// Prepare for next iteration (next nested square)%0A%09%09%09rowIndex += 2;%0A%09%09%09colIndex += 2;%0A%09%09%09minRowIndex += 2;%0A%09%09%09minColIndex += 2;%0A%09%09%09maxRowIndex -= 2;%0A%09%09%09maxColIndex -= 2;%0A%09%09%09%0A%09%09%09loopCount++;%0A%09%09%7D%0A%09%09%0A%09%09// Convert drawingMatrix to String array%0A%09%09for (int i = 0; i %3C drawingMatrix.length; ++i) %7B%0A%09%09%09drawing%5Bi%5D = String.valueOf( drawingMatrix%5Bi%5D );%0A%09%09%7D%0A%09%09%0A%09%09return drawing;%0A%09%7D%0A%7D%0A

Create Target.java