![]() |
VOOZH | about |
Here, we will print the boundary elements of a matrix using a C program:
Input : 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 Output : 1 2 3 4 1 4 1 4 1 2 3 4
Example:
Input Matrix 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 Boundary of Matrix 1 2 3 4 1 4 1 4 1 2 3 4
Time Complexity: O(n*n), where n is the size of the array.
Space Complexity: O(1).