Question bank › Matrix
Dsa Matrix Easy

Matrix Boundary Elements

Given an M x N matrix of integers, return the boundary elements in clockwise order. Input format: - The first line contains two integers, M and N, the dimensions of the matrix. - The next M lines contain N integers representing the matrix elements. Output format: - A single line containing the boundary elements in clockwise order, separated by spaces. Example: Input: 3 4 1 2 3 4 5 6 7 8 9 10 11 12 Output: 1 2 3 4 8 12 11 10 9 5 6 7

Key concepts

matrixboundaryextraction

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.