Легко Решено: 0 Процент решений: 0%

Pyramid Rows

Draw a right-aligned pyramid of # blocks.

Условие

Draw a right-aligned pyramid like the one in Super Mario: row i (counting from 1) has height − i spaces followed by i # characters.

Implement pyramid_rows(height).

Input

height: The number of rows.

Output

Return the rows from top to bottom.

Ограничения

0 ≤ height ≤ 50

Примеры

Пример 1
Ввод:
height = 3

Ожидаемый вывод:
expected = ["  #", " ##", "###"]
Ввод:
long long height = 3;

Ожидаемый вывод:
std::vector<std::string> expected = {"  #", " ##", "###"};
Ввод:
long height = 3;

Ожидаемый вывод:
string[] expected = new string[] {"  #", " ##", "###"};

Пояснение

Rows are " #", " ##" and "###": each row has one more block and one less space.

Пример 2
Ввод:
height = 1

Ожидаемый вывод:
expected = ["#"]
Ввод:
long long height = 1;

Ожидаемый вывод:
std::vector<std::string> expected = {"#"};
Ввод:
long height = 1;

Ожидаемый вывод:
string[] expected = new string[] {"#"};

Пояснение

A single row with one block: "#".

Ссылки

Это задание адаптировано для CodeUtility. Следуйте условию и ограничениям выше.

Учитесь у других

Решения сообщества

Пока нет опубликованных решений. Решите задание, чтобы поделиться первым.