Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Triangle Quest 2 Hacker Rank Solution – Queslers

Problem: Triangle Quest 2 Hacker Rank Solution

You are given a positive integer N.
Your task is to print a palindromic triangle of size N.
For example, a palindromic triangle of size 5 is:

1
121
12321
1234321
123454321

You can’t take more than two lines. The first line (a for-statement) is already written for you.
You have to complete the code using exactly one print statement.Note :Using anything related to strings will give a score of 0.
Using more than one for-statement will give a score of 0.

Input Format :

A single line of input containing the integer N.

Constraints :

  • 0 < N < 10

Output Format :

Print the palindromic triangle of size  N as explained above.

Sample Input :

5

Sample Output :

1
121
12321
1234321
123454321

Triangle Quest 2 Hacker Rank Solution in python 2

for i in range(1,int(raw_input())+1): #More than 2 lines will result in 0 score. Do not leave a blank line also
    print sum(map(sum, map(lambda y: map(lambda x: 10 ** x, xrange(y)), xrange(1, i + 1)))) * (10 ** (i-1))+sum(map(sum, map(lambda y: map(lambda x: 10 ** (i - x - 2), xrange(y)), xrange(1, i))))

Triangle Quest 2 Hacker Rank Solution in python 3

for i in range(1,int(input())+1): #More than 2 lines will result in 0 score. Do not leave a blank line also
    print (((10**i - 1)//9)**2)

Triangle Quest 2 Hacker Rank Solution in pypy

for x in range(1,int(input())+1):
    print(((10**x - 1)//9)**2)

Triangle Quest 2 Hacker Rank Solution in pypy 3

for x in range(1,int(input())+1):# Enter your code here. Read input from STDIN. Print output to STDOUT
    print(((111111111)%(10**x))**2)
Triangle Quest 2 Hacker Rank Solution Review:

In our experience, we suggest you solve this Triangle Quest 2 Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Triangle Quest 2 is available on Hacker Rank for Free, if you are stuck anywhere between compilation, just visit Queslers to get all Hacker Rank Solution

riangle Quest 2 Hacker Rank Solution Conclusion:

I hope this Triangle Quest 2 Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Hacker Rank Problem & Solutions >>

itertools.product() Hacker Rank Solution

String Validators Hacker Rank Solution

Text Alignment Hacker Rank solution

String validators Hacker Rank Solution

Staircase Hacker Rank Solution

Leave a Reply

Your email address will not be published. Required fields are marked *