• + 0 comments

    From a java perspective a solution would be like below:

        public static void staircase(int n) {
            IntStream.range(1, n+1).forEach(i -> {
                printChars((n-i), " ");
                printChars(i, "#"); 
                System.out.println("");
            });
        }
        
        public static void printChars(int count, String c) {
            for (int i = 0; i < count; i ++) {
               System.out.print(c);
            }
        }