Print this pattern! - Adobe Interview Question

in #utopian-io6 years ago

Given an integer n, you need to print the following pattern pattern.

Examples:

n=4

Output :
4444444
4333334
4322234
4321234
4322234
4333334
4444444

n=3

Output :
33333
32223
32123
32223
33333

Input:

The first line of the input contains a single integer T, denoting the number of test cases. Then T test cases follow. Each test case contains one lines of input denoting the value of n.

Output:
For each test case, Print the mentioned pattern.

Constraints:
1<=T<=100
1<=N<=9

Example:

Input:
2
3
4

Output:
33333
32223
32123
33333
4444444
4333334
4322234
4321234
4322234
4333334
4444444

Sort:  

Congratulations @gokstar! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You made your First Comment

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.030
BTC 60115.56
ETH 3203.28
USDT 1.00
SBD 2.46