• + 6 comments

    I had the same general idea, but it's not passing even though the output is identical :/

    import java.io.*;
    import java.util.*;
    
    public class Solution {
    
        public static void main(String[] args) {
           Scanner scan = new Scanner(System.in);
           int stairs = scan.nextInt();
           for (int i = 0; i < stairs; i++) 
            System.out.printf("%" + (stairs + 1) + "s",  new String(new char[i + 1]).replace("\0", "#") + "\r");
        }
        
    }
    

    edit: crap. changed the CR to newline and it passed.