INFOTECH Coding Question – Solved

10 Live
The longest diagonals of a square matrix are defined as follows: - The first longest diagonal goes from the top-left corner to the bottom-right corner. - The second longest diagonal goes from the top-right corner to the bottom-left corner. Given a square matrix, your task is to swap its longest diagonals by exchanging their elements at the corresponding positions. Example: matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

Asked in: INFOTECH

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| Given an n x m grid, where rows are numbered from 7 to n and columns from 1 to … |
| There are 'N' coders standing in a line, where i denotes the ith position of a … |
| A birthday party was attended by N number of kids, and each kid was given a uni… |
| Given a matrix of size m * n, where m denotes the number of rows (starting with… |
| A traveler is traveling from the city of Zeta to Omega. He starts with X amount… |
| As an operations engineer at Amazon, you are responsible for organizing the dis… |