@@ -0,0 +1,2068 @@
+import java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0A%0A// https://www.hackerrank.com/challenges/staircase/problem%0Apublic class Staircase %7B%0A%0A  private static final String SPACE = %22 %22;%0A  private static final String LINE_FEED = %22%5Cn%22;%0A%0A  private static int readInput() throws IOException %7B%0A    try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) %7B%0A      String line = reader.readLine();%0A      return Integer.parseInt(line);%0A    %7D%0A  %7D%0A%0A  /**%0A   * Given a number representing the base of the staircase, return a matrix%0A   * representing the staircase to be printed in stdout.%0A   *%0A   * The complexity of this algorithm is: O(n log n) %3C complexity %3C O(n%5E2)%0A   *%0A   * Example: n = 256%0A   * O(n log n) %3C complexity %3C O(n%5E2)%0A   * = 256 * 8 %3C 16_512 %3C 256 * 256%0A   * = 2_048 %3C 16_512 %3C 65_536%0A   *%0A   * @param staircaseBase number representing the base of the staircase.%0A   * @return matrix representing the staircase to be printed.%0A   */%0A  private static String%5B%5D%5B%5D getStaircase(int staircaseBase) %7B%0A    String%5B%5D%5B%5D matrix = new String%5BstaircaseBase%5D%5BstaircaseBase%5D;%0A    int rowCount = 0;%0A    for (int row = staircaseBase; rowCount %3C row; row--) %7B%0A      int correctedRow = row - 1; // Used to access positions in the matrix.%0A      for (int column = rowCount; column %3C row; column++) %7B%0A        matrix%5BcorrectedRow%5D%5Bcolumn%5D = %22#%22;%0A        matrix%5Bcolumn%5D%5BcorrectedRow%5D = %22#%22;%0A      %7D%0A      rowCount++;%0A    %7D%0A    return matrix;%0A  %7D%0A%0A  private static void print(String%5B%5D%5B%5D matrix) %7B%0A    StringBuilder builder = new StringBuilder();%0A    for (String%5B%5D row : matrix) %7B%0A      for (String cell: row) %7B%0A        if (cell == null %7C%7C cell.isEmpty()) %7B%0A          builder.append(SPACE);%0A        %7D else %7B%0A          builder.append(cell);%0A        %7D%0A      %7D%0A      builder.append(LINE_FEED);%0A    %7D%0A    System.out.println(builder.toString());%0A  %7D%0A%0A  public static void main(String%5B%5D args) throws IOException %7B%0A    int staircaseBase = readInput();%0A    String%5B%5D%5B%5D staircase = getStaircase(staircaseBase);%0A    print(staircase);%0A  %7D%0A%7D%0A

Add solution for Staircase problem.