Draw The Triangle 2
- URL : https://www.hackerrank.com/challenges/draw-the-triangle-2/problem
- P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5):
1
2
3
4
5
*
* *
* * *
* * * *
* * * * *
- Write a query to print the pattern P(20).
- MySQL Solution
1
2
3
4
set @number = 0;
select repeat('* ', @number := @number + 1)
from information_schema.tables
where @number < 20