728x90
■ [Alternative Queries] Draw The Triangle 1
https://www.hackerrank.com/challenges/draw-the-triangle-1/problem?isFullScreen=true
Q.
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).
A.
SELECT RPAD('* ', (20-LEVEL+1)*2, '* ') FROM DUAL CONNECT BY LEVEL <= 20; -- RPAD('*', (20-LEVEL+1)*2, ' *')
■ [Alternative Queries] Draw The Triangle 2
https://www.hackerrank.com/challenges/draw-the-triangle-2/problem?isFullScreen=true
Q.
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).
A.
SELECT RPAD('* ', LEVEL*2, '* ') FROM DUAL CONNECT BY LEVEL <= 20; -- RPAD('*', LEVEL*2, ' *')
반응형
'코딩 문제 풀기 ( Algorithm problem solving ) > 해커랭크 ( HackerRank )' 카테고리의 다른 글
[HackerRank][SQL(Oracle)] Binary Tree Nodes (0) | 2023.03.29 |
---|---|
[HackerRank][SQL(Oracle)] Placements (0) | 2023.03.29 |
[HackerRank][SQL(Oracle)] Type of Triangle (0) | 2023.03.29 |
[HackerRank][SQL(Oracle)] Average Population of Each Continent, Population Census, African Cities (0) | 2023.03.27 |
[HackerRank][SQL(Oracle)] The Blunder (0) | 2023.03.27 |