Algorithm


Problem Name: Sql - Draw The Triangle 2

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

In this HackerRank Functions in SQL problem solution,

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).

 

 

Code Examples

#1 Code Example with MySQL

Code - MySQL


SET @TEMP:=0; 
SELECT REPEAT('* ', @TEMP:= @TEMP + 1) 
FROM INFORMATION_SCHEMA.TABLES
WHERE @TEMP  <  20;
Copy The Code & Try With Live Editor
Advertisements

Demonstration


Previous
[Solved] Java Arraylist in Java solution in Hackerrank - Hacerrank solution Java
Next
[Solved] The PADS in SQL solution in Hackerrank