Algorithm


Problem Name: Sql - Draw The Triangle 1

Problem Link: https://www.hackerrank.com/challenges/draw-the-triangle-1/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:=21; 
SELECT REPEAT('* ', @TEMP:= @TEMP - 1) 
FROM INFORMATION_SCHEMA.TABLES;
Copy The Code & Try With Live Editor
Advertisements

Demonstration


Previous
[Solved] Java Subarray in Java solution in Hackerrank - Hacerrank solution Java
Next
[Solved] Draw The Triangle 2 in SQL solution in Hackerrank