[ūüíĽCHALLENGEūüĖ•]Matrix(2D)-Based | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 2


A matrix consists of n√ón elements.Change the matrix such that all 1st diagonal elements have the value of 1st maximum in the matrix, all 2nd diagonal elements have 2nd maximum value in the matrix and so on(nth diagonal elements have value of nth maximum). assume that all entries in the matrix are unique. example:matrix: 1 3 2 4 7 9 5 6 15 (3√ó3) required matrix 7 9 15 9 7 9 15 9 7 1stmax=15 2nd=9... OPTIMIZE your algorithm. BEST OF LUCK!!

10th Dec 2017, 8:46 AM
Abdul Sattar Mapara
3 Respostas
10th Dec 2017, 4:34 PM
K√§z√ģ Mr√ģd√Ļl H√łss√§√ģn
K√§z√ģ Mr√ģd√Ļl H√łss√§√ģn - avatar
+ 3
10th Dec 2017, 11:28 AM
+ 3
@Abdul thanks for the challenge some interisting problems inside. The matrix is random from 3x3 to 9x9. also numbers in matrix are random but different. the formula for diagonals took me half an hour anyhow here is my coding: https://code.sololearn.com/cjmgUey0I7xf/?ref=app
10th Dec 2017, 11:57 AM
Oma Falk
Oma Falk - avatar