Created
April 25, 2024 10:20
-
-
Save Filimon4/95ed59895726c94049158b0ea117d504 to your computer and use it in GitHub Desktop.
Первый задача
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reverseTree(len: number) { | |
const stars = Array<number>(len).fill(0).map<number>((el, idx) => idx+1).reverse() | |
for (let row: number = 1; row < len * 2; row++) { | |
let offset: number = Math.abs((len - row)%len); | |
process.stdout.write(`${Array(offset).fill(" ").join('')}${Array(stars[offset]).fill("*").join(" ")}\n`) | |
} | |
} | |
reverseTree(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment