Sort by

recency

|

5170 Discussions

|

  • + 0 comments

    time Complexity = O(n)

    def staircase(n: int):
        for x in range(1, n + 1):
            print(" " * (n - x) + "#" * x)
    
  • + 0 comments

    Here is the website that published all the problems solutions - Programmingoneonone

  • + 0 comments
    def staircase(n):
        n_spaces = n - 1
        for i in range(1, n + 1):
            print(n_spaces * ' ' + i * '#')
            n_spaces -= 1
        
    if __name__ == '__main__':
        n = int(input().strip())
        staircase(n)
    
  • + 0 comments

    Java 15

    public static void staircase(int n) { int repeat = 1; for(int i=n ; i > 0; i-- ) { System.out.println(" ".repeat(i-1)+"#".repeat(repeat++)); }

    }
    
  • + 0 comments

    **//C# **

    public static void staircase(int n)
    {
        string symbol="";
    
        for(int i=0;i<n;i++){
            string space = "";
            for(int j=0;j<n-(i+1);j++){
                space=space+" ";
    
            }
            symbol=symbol+"#";
            Console.WriteLine(space+symbol);
        }
    
    }