Spiral Matrix

Posted on May 4, 2018 by Edit

Given a input of N, prints 1 to (N * N) numbers in spiral matrix order.

E.g.: Input: 5

Output:

1	16	15	14	13	
2	17	24	23	12	
3	18	25	22	11	
4	19	20	21	10	
5	6	7	8	9
For given matrix size, print number is Spiral form.

Java

loading...
Tags : java
This website is made possible by displaying online advertisements to our visitors.
Please consider supporting by disabling your ad blocker.
loading comments...