dimanche 9 février 2020

I want to print a pattern in Java with the help of a dynamic matrix [duplicate]

I want to write a generic method, which will print patterns as given below function. For example n =2 Then pattern will be 2 2 2, 2 1 2, 2 2 2, If n=3.

33333,
32223,
32123,
32223,
33333

And so on for other values of n. Till now i have figured this thing out that, the size of the matrix will be(2n-1). Can anyone help in this. ASAP

Aucun commentaire:

Enregistrer un commentaire