Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
1 1 2 1 3 1
1 2 2 2 3 2
1 3 2 3 3 3
1 4 2 4 3 4
1 5 2 5 3 5

What I have tried:

I had no clue to reach this one .
Posted
Updated 10-Sep-21 10:20am
Comments
Dave Kreskowiak 10-Sep-21 13:57pm    
You're going to have to explain a lot more about where this problem came from and any other details about it if you want any kind of usable answer.
Member 15329613 10-Sep-21 14:02pm    
Very easy.
Print 1 1 2 1 3 1
Print 1 2 2 2 3 2
and keep going.

Or, actually give enough information for anyone else to actually help you.

1 solution

Quote:
I had no clue to reach this one.

As programmer, your job is to decipher problems. you will get good at this only by practicing.
Look at this pattern:
1 1 1 1 1
1 2 3 4 5
2 2 2 2 2
1 2 3 4 5
3 3 3 3 3
1 2 3 4 5


I just pivoted transposed your problem, columns are rows, and row are columns.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900