Skip to content

Instantly share code, notes, and snippets.

@ThienTranDuy
Created April 20, 2020 03:53
Show Gist options
  • Save ThienTranDuy/28f7267bc6c2af37bcdaf0ddce0a8ce8 to your computer and use it in GitHub Desktop.
Save ThienTranDuy/28f7267bc6c2af37bcdaf0ddce0a8ce8 to your computer and use it in GitHub Desktop.
Hackerrank challenge - staircase - https://www.hackerrank.com/challenges/staircase/problem
function staircase($n) {
for ($i = 0; $i < $n; $i++) {
echo str_repeat(" ", ($n - $i -1)). str_repeat("#", ($i + 1)) . "\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment