โจทย์
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 กรุณาทำตามคำชี้แจงและข้อจำกัดด้านบน