[hackerrank] 삼각형 그리기

https://www.hackerrank.com/challenges/draw-the-triangle-1/problem?isFullScreen=true

(1)

P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5):

* * * * * 
* * * * 
* * * 
* * 
*
Write a query to print the pattern P(20).

set @number = 21;
SELECT repeat('* ', @number := @number - 1) 
FROM information_schema.tables

(2)

P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5):

* 
* * 
* * * 
* * * * 
* * * * *
Write a query to print the pattern P(20).
/*
Enter your query here.
*/

set @number = 0;
SELECT repeat('* ', @number := @number + 1) 
FROM information_schema.tables
WHERE @number < 20

좋은 웹페이지 즐겨찾기