쉬움 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에 맞게 수정되었습니다. 위의 설명과 제한 조건을 따르세요.

다른 사람의 풀이 보기

커뮤니티 솔루션

아직 공개된 풀이가 없습니다. 문제를 풀고 첫 풀이를 공유하세요.