'Coding has over 700 languages', '67% of programming jobs aren’t in the technology industry', 'Coding is behind almost everything that is powered by electricity'
Topics

Mirror image of triangle

Easy
0/40
Average time to solve is 10m
profile
Contributed by
4 upvotes
Asked in companies
Hewlett Packard EnterpriseInfosysAirtel

Problem statement

Ninja’s younger sister got a project to print the pattern for the given number of rows, say ‘N’. She finds it difficult to write such a pattern for every ‘N’.

Ninja decided to help his sister and decided to write a code for this but wasn't able to write the code for the same. Ninja wants help to write a code and asks you for help. Help Ninja.

Example:

Pattern for N = 2
    0
   101
  21012
Detailed explanation ( Input/output format, Notes, Images )
Constraints :
1 <= T <= 5
1 <= N <= 100

Time Limit: 1 sec.

Sample Input 1 :

2
1
2

Sample Output 1 :

 0
101
  0
 101
21012
Explanation for Sample Input 1 :
Test Case 1:
 For ‘N’  = 1 , we need to print 2 rows - in first row 0, and second row 1 0 1.
Test Case 2:
The Number of rows for ‘N’ = 2 will be 3.

Sample Input 2 :

2
3
4

Sample Output 2 :

    0
   101
  21012
 3210123
432101234
     0
    101
   21012
  3210123
 432101234
54321012345
Full screen
Console