INFOTECH Coding Question – Solved

9 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

| You are given a board of size M Γ— N where each cell can be either empty ('O') o… |
| Undirected Coloured Graph Shortest Path You are given an undirected weight… |
| Village Voyage A computer game "Village Voyage" has N villages (labeled 1 to… |
| Academic Decathlon Students are being selected for an academic decathlon tea… |
| Sum of Arrays Given two arrays each of length n, arr1 and arr2, in one opera… |
| Count Swaps During Custom Sorting Analyze the efficiency of the following so… |