Microsoft, Recently Asked Online Assessments in November, 2025 | Diagonal Traversal of Matrix | 2D Arrays
Microsoft · Question · Posted Jun 2026
Question 1: Diagonal Traversal of Matrix Problem Statement Given a 2D matrix of size NxN, print the sum of the elements of all its diagonals. Input Format The first line of input contains T - the number of test cases. The first line of each test case contains N - the size of the matrix. Each of the next N lines contains N integers - the elements of the matrix. Output Format For each test case, print the sum of ...
The full answer & interview discussion are available to premium members.
Log in Create a free account