Right-Aligned Staircase

This exercise trains working with strings, spaces, and text alignment. The function staircase receives a height n and builds a staircase using the # character. Each next row has one more hash, and the whole staircase is right-aligned to width n. Return the finished rows as a list of strings.

Примеры

Ввод
4
Вывод
[" #", " ##", " ###", "####"]
Ввод
1
Вывод
["#"]
Ввод
2
Вывод
[" #", "##"]

Нужно реализовать

def staircase(n: int) -> list[str]:

Теги

stringsmath
PostgreSQLv16

Your code output will appear here

Visible tests
1
Input
4
Expected[" #"," ##"," ###","####"]
2
Input
1
Expected["#"]
3
Input
2
Expected[" #","##"]
4
Input
3
Expected[" #"," ##","###"]
5
Input
6
Expected[" #"," ##"," ###"," ####"," #####","######"]
6
Input
0
Expected[]
Focus radio
Paused · SomaFM · Fluid