Problem
Übersetzung anzeigenDraw 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.
Einschränkungen
0 ≤ height ≤ 50
Beispiele
Eingabe:
height = 3
Erwartete Ausgabe:
expected = [" #", " ##", "###"]
Eingabe:
long long height = 3;
Erwartete Ausgabe:
std::vector<std::string> expected = {" #", " ##", "###"};
Eingabe:
long height = 3;
Erwartete Ausgabe:
string[] expected = new string[] {" #", " ##", "###"};
Erläuterung
Rows are " #", " ##" and "###": each row has one more block and one less space.
Eingabe:
height = 1
Erwartete Ausgabe:
expected = ["#"]
Eingabe:
long long height = 1;
Erwartete Ausgabe:
std::vector<std::string> expected = {"#"};
Eingabe:
long height = 1;
Erwartete Ausgabe:
string[] expected = new string[] {"#"};
Erläuterung
A single row with one block: "#".
Referenzen
Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.