diff --git a/src/hackerrank/warmup/staircase.md b/src/hackerrank/warmup/staircase.md new file mode 100644 index 0000000..201bcc1 --- /dev/null +++ b/src/hackerrank/warmup/staircase.md @@ -0,0 +1,67 @@ +# [Staircase](https://www.hackerrank.com/challenges/staircase) + +Difficulty: #easy +Category: #warmup + +Staircase detail +This is a staircase of size $ n = 4 $: + +```text + # + ## + ### +#### +``` + +Its base and height are both equal to n. It is drawn using # symbols +and spaces. The last line is not preceded by any spaces. + +Write a program that prints a staircase of size n. + +## Function Description + +Complete the staircase function in the editor below. + +staircase has the following parameter(s): + +* int n: an integer + +## Print + +Print a staircase as described above. + +## Input Format + +A single integer, , denoting the size of the staircase. + +Constraints + +$ 0 < n \leq 100 $ + +## Output Format + +Print a staircase of size n using # symbols and spaces. + +Note: The last line must have spaces in it. + +## Sample Input + +```text +6 +``` + +## Sample Output + +```text + # + ## + ### + #### + ##### +###### +``` + +## Explanation + +The staircase is right-aligned, composed of # symbols and spaces, +and has a height and width of $ n = 6 $. diff --git a/src/hackerrank/warmup/staircase.ts b/src/hackerrank/warmup/staircase.ts index ef3340b..dab63fe 100644 --- a/src/hackerrank/warmup/staircase.ts +++ b/src/hackerrank/warmup/staircase.ts @@ -1,69 +1,3 @@ -/** - * Staircase - * - * https://www.hackerrank.com/challenges/staircase - * - * Difficulty: #easy - * Category: #warmup - * - * Staircase detail - * This is a staircase of size n = 4: - * ``` - * # - * ## - * ### - * #### - * ``` - * - * Its base and height are both equal to n. It is drawn using # symbols - * and spaces. The last line is not preceded by any spaces. - * - * Write a program that prints a staircase of size n. - * - * # Function Description - * - * Complete the staircase function in the editor below. - * - * staircase has the following parameter(s): - * - * * int n: an integer - * - * # Print - * Print a staircase as described above. - * - * # Input Format - * A single integer, , denoting the size of the staircase. - * - * Constraints - * - * 0 < n <= 100 - * - * # Output Format - * - * Print a staircase of size n using # symbols and spaces. - * - * Note: The last line must have spaces in it. - * - * # Sample Input - * ``` - * 6 - * ``` - * - * # Sample Output - * ``` - * # - * ## - * ### - * #### - * ##### - * ###### - * ``` - * - * # Explanation - * The staircase is right-aligned, composed of # symbols and spaces, - * and has a height and width of n = 6. - */ - export function staircase(n: number): string { const result: string[] = [];