๐ข ๋ณธ ํฌ์คํ ์ ํ์ฉ๋๋ ๊ธฐ๋ณธ ๋ฌธ์ ๋ฐ ์๋ฃ ์ถ์ฒ๋ HackerRank ์์ ๋ฐํ๋๋ค.
โ ๋ฌธ์
https://www.hackerrank.com/challenges/draw-the-triangle-1/problem?isFullScreen=true
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 @NUM = 21;
SELECT REPEAT('* ', @NUM := @NUM -1)
FROM information_schema.tables;
๐ REPEAT(str, count)
๋ฌธ์์ด ๋ฐ๋ณตํด์ ์ถ๋ ฅํ๋ ํจ์
- str : ๋ฐ๋ณต๋ฌธ์์ด
- count : ๋ฐ๋ณต
๐ Information_schema
MySQL ์๋ฒ ๋ด ์กด์ฌํ๋ DB์ ๋ฉํ ์ ๋ณด(ํ ์ด๋ธ, ์นผ๋ผ, ์ธ๋ฑ์ค ๋ฑ์ ์คํค๋ง ์ ๋ณด)๋ฅผ ๋ชจ์๋ DB
INFORMATION_SCHEMA ๋ฐ์ดํฐ๋ฒ ์ด์ค ๋ด์ ๋ชจ๋ ํ ์ด๋ธ์ ์ฝ๊ธฐ ์ ์ฉ์ด๋ฉฐ, ๋จ์ ์กฐํ๋ง ๊ฐ๋ฅ.
์ค๋ช ์ฐธ๊ณ ์ฌ์ดํธ > https://rk1993.tistory.com/230 |
'Growth ๐ณ > Practice ๐ป' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Hacker Rank] Occupations (0) | 2022.09.20 |
---|---|
[Hacker Rank] Draw The Triangle 2 (1) | 2022.09.20 |
[๊ณผ์ ] Pythob2022 #03 ์ฐ์ต๋ฌธ์ (0) | 2022.08.27 |
[Hacker Rank] Placement (0) | 2022.08.27 |
[Hacker Rank] Top Competitors (0) | 2022.08.27 |