Print this pattern! - Adobe Interview Question

in utopian-io •  7 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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

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!